-
Notifications
You must be signed in to change notification settings - Fork 216
chore(common): Optimise build times for sdk #2925
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
base: master
Are you sure you want to change the base?
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ code/snyk check is complete. No issues have been found. (View Details) |
@@ -0,0 +1,197 @@ | |||
# Webpack Build Speed Analysis Results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this file? I'd say it makes more sense for this to be a blog post rather than a markdown file in the repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a working doc for now, since there are follow up items that I want to leverage from this doc. I wanted to break the work before round 2 of improvements as we have achieved a decent state.
"scripts": { | ||
"prepare": "check-node-version --node '>=22' --npm '>=10'", | ||
"build": "npm run bundle && npm run bundle-dts", | ||
"build": "npx nx reset && npm run bundle && npm run bundle-dts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should reset the cache on every build, otherwise it defeats the purpose of having cache in the first place. We only need to reset cache when we are iterating and testing changes to the build script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were issues with the optimisations and nx cache hence I had to reset cache here.
loader: 'ts-loader', | ||
loader: 'esbuild-loader', | ||
options: { | ||
target: 'es2018', // Modern target without IE 11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's align the version with checkout-js
first as our first step, which is es2015
What?
Optimise build times for sdk.
Why?
SDK compilation is very slow, almost taking 3-4 mins for build, 1 min for bundle watch. Switch to esbuild-loader to get faster build times.
Have also added an analysis doc and what the next potential changes should be.
Testing / Proof
Before
npm run build
npm run bundle:watch
After
npm run build
npm run bundle:watch
@bigcommerce/team-checkout @bigcommerce/team-payments