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

Optimizing the build/install process of MFE #25

Open
ghassanmas opened this issue Oct 26, 2021 · 1 comment
Open

Optimizing the build/install process of MFE #25

ghassanmas opened this issue Oct 26, 2021 · 1 comment

Comments

@ghassanmas
Copy link
Member

Relates #21 Regarding optimizing the build/install process of the frontend.

There are 3 sections, for install, build and for both.

1. Optimizing the install process (for production)

When running npm install for production typically the case is to to install the node packages just so the project can be built, and then to use the bundle..etc. In that case, we might opt out for installing the dev dependency and

1.1 Skip auditing

When running npm install, npm by default runs auditing scripts to recommend fixes to detect the vulnerability, however sometimes this is not necessary, for example when developing or when running automated scrips, so changing this flag either in tutor or devstak would increase time about 10% lower
npm install --no-audit

1.2 Skip dev-depedency

This should be very useful exactly when running on production, for example, if we are only going to build the MFE app, there wouldn’t need either to check or install the dev-dependency.
npm install --only=prod

Note: Both options above can be used in conjunction i.e. npm install --only=prod -no-audit

2. Optimizing the build process

Haven't personally digged into yet, though there is a discussion/issue already opened in the BTRWG here: openedx/wg-build-test-release#8

3. Optimizing both the build and install process

This section suggests actions or steps, that might influence both the install and the build process

3.1 Upgrade to NPM >=7

NPM version 7 started using the new version of the lock file, in other words, it deals with the pacakge-lock.json in a different way, one of the reason for the new version is intended to enhance how the npm handles the dependency tree have optimized these processes, ref

As of npm v7, lockfiles include enough information to gain a complete picture of the package tree, reducing the need to read package.json files, and allowing for significant performance improvements.

@davidjoy
Copy link
Contributor

To me this sounds like a documentation task, since operators are responsible for their own build/deployment infrastructure today, for the most part. We're expecting to upgrade to npm 8 as part of the Node 16 upgrade here: #2

I'd offer up that npm ci is intended to be used for these use cases, rather than npm install: https://docs.npmjs.com/cli/v7/commands/npm-ci

From the documentation, it sounds like it comes with a significant performance boost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants