-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Remove test packages from production bundles #2330
Remove test packages from production bundles #2330
Conversation
ok to test |
Hey @leosoaivan, thanks for digging into this. It looks like something with webpack-bundle-analyzer is breaking the review app build. snippet from the stacktrace:
I've sent you an invite to the Heroku pipeline the review app's are built on so you can have a play with it. |
const webpack = require('webpack'); | ||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer') |
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.
ahh It might be this, do we only want the bundle-analyzer in development mode since production will ignore the dev dependencies?
I think moving all the webpack-bundle-analyzer stuff to config/webpack/development.js
will fix the build issue if thats the case.
I'm guessing this is going to be redundant soon with the shakapacker switch - #3031 Is this something we should still have a look at? |
Closing due to inactivity |
Because:
An analysis of our javascript packs/bundle showed test packages being included, including
@testing-library
andpretty-format
.Presently, it doesn't appear as though there is an option in webpacker.yml for an exclude path/pattern (see here). Therefore, it appears as though webpacker is creating an abstract syntax tree that includes all JS files in
app/javascript/
, including the component test files. This would explain why the final bundle includes the 2 aforementioned packages, and not Jest.This reduces our bundle size by about 200KB.
This commit
**/__tests__/*
Checklist