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
Do not build json3 module with Webpack #977
Conversation
@@ -17,7 +17,7 @@ | |||
"start-dev": "npm-run-all --parallel watch start", | |||
"build": "npm-run-all build:*", | |||
"build:font-awesome": "node scripts/build-fontawesome.js", | |||
"build:webpack": "webpack", | |||
"build:webpack": "webpack --progress", |
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.
Is this a side-effect of the rest of this PR, or just something you've added along the way?
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.
Along the way.
package.json
Outdated
@@ -75,6 +75,7 @@ | |||
"socket.io-client": "1.7.3", | |||
"stylelint": "7.9.0", | |||
"urijs": "1.18.9", | |||
"webpack": "2.2.1" | |||
"webpack": "2.2.1", | |||
"webpack-remove-debug": "0.1.0" |
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 comes from https://github.com/johngodley/webpack-remove-debug.
1 commit only, 0 stars/forks, pretty much no downloads... Shouldn't we inline the 6 lines of code of this project directly into our Webpack config, instead?
Also, I'm curious of such little usage of this, what do other projects do, they just leave the debug stuff in there?
Finally, do we want to remove this from both production and development environment, or is there an interest in keeping this in dev mode?
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.
Yes i was thinking about inlining it.
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 tried to inline it (using a function) but it looks like we have to make it an internal module in its own file and set it as loader: "./file"
. That sucks. Anyone knows a way we could use to simply define this one-line function at the top of the webpack config and call that function from the loader?!
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.
Could just exclude it and only keep the json3 trick.
fea46d1
to
9bf1e6e
Compare
👍 |
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.
Tested locally and it works OK. It does save a small chunk so nice! In dev env, vendor package went from 799kb to 755kb, in prod env it went from 259kb to 251kb (looked at Travis).
I moved to debug stuff to #993 for reference. Merging this with one review as it's a very simple change and comes from a maintainer. |
Do not build json3 module with Webpack
Both of these are only used by
socket.io
and it contributes an unnecessary amount of size in the final vendor chunk. It removes 23kB from the final vendor chunk in production build.