Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#51784 new enhancement

Build/Test Tools: Consider always running npm install with --no-optional

Reported by: azaozz's profile azaozz Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: 2nd-opinion has-patch
Focuses: Cc:

Description

Currently there are 248 optional third (and forth, fifth) party dependencies in package-lock.json that don't seem needed.

Running npm install --no-optional seems to still install many of them (presumably as they are needed by other dependencies) but reduces the overall size of node_modules by about 40MB and speeds things up a bit.

Attachments (1)

51784.diff (297 bytes) - added by azaozz 3 years ago.

Download all attachments as: .zip

Change History (3)

#1 @azaozz
3 years ago

Similarly dev-dependencies of third party packages (and sub-dependency packages) don't seem needed either but there isn't a clear way to skip these for the moment (as far as I see). Doing --only=prod would skip top-level (our own) dev dependencies too.

@azaozz
3 years ago

#2 @azaozz
3 years ago

  • Keywords 2nd-opinion has-patch added

In 51784.diff: Set npm to skip optional dependencies.

However that may not be good, see the corresponding issue for Gutenberg: https://github.com/WordPress/gutenberg/issues/26993.

Note: See TracTickets for help on using tickets.