Skip to content

Consolidate redundant dependencies in built binary #7965

@flotwig

Description

@flotwig

Current behavior:

During prod builds, yarn is run in each subpackage individually:

const retryNpmInstall = function (pkg) {
console.log('installing %s', pkg)
console.log('NODE_ENV is %s', process.env.NODE_ENV)
// force installing only PRODUCTION dependencies
// https://docs.npmjs.com/cli/install
const npmInstall = _.partial(yarn, ['install', '--production'])
return npmInstall(pkg, { NODE_ENV: 'production' })
.catch({ code: 'EMFILE' }, () => {
return Promise
.delay(1000)
.then(() => {
return retryNpmInstall(pkg)
})
}).catch((err) => {
console.log(err, err.code)
throw err
})
}

Desired behavior:

Run yarn in the root to take advantage of dependency hoisting. This will help reduce the overall binary size

This will require some reworking of the existing build process. Only production dependencies should be installed in the final .zip, but some dev dependencies are needed for the build process.

Related: #5977

Metadata

Metadata

Assignees

Labels

process: buildRelated to our internal build processstage: ready for workThe issue is reproducible and in scope

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions