Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate redundant dependencies in built binary #7965

Closed
flotwig opened this issue Jul 13, 2020 · 1 comment
Closed

Consolidate redundant dependencies in built binary #7965

flotwig opened this issue Jul 13, 2020 · 1 comment
Assignees
Labels
process: build Related to our internal build process stage: ready for work The issue is reproducible and in scope

Comments

@flotwig
Copy link
Contributor

flotwig commented Jul 13, 2020

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

@flotwig
Copy link
Contributor Author

flotwig commented May 26, 2022

This was completed in #17285

@flotwig flotwig closed this as completed May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
process: build Related to our internal build process stage: ready for work The issue is reproducible and in scope
Projects
None yet
Development

No branches or pull requests

2 participants