-
Notifications
You must be signed in to change notification settings - Fork 6
Conversation
|
||
// **WARNING**: Mutates base configuration. | ||
// We do this because lodash isn't available in `production` mode. | ||
config.output.filename = config.output.filename.replace(/\.min\.js$/, ".js"); | ||
config.plugins = [ | ||
new LodashModuleReplacementPlugin(), | ||
new webpack.optimize.OccurenceOrderPlugin(), |
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 not do this. It often is worse / no op for min + gz
and muddles things up.
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.
You mean the OccurenceOrderPlugin
? I can remove it
@okonet -- The dev build isn't our main target. We'd ideally like |
The reason I'm posting dev numbers is the fact I can't build current master without errors having this module symlinked. Not sure how to test it otherwise. |
@okonet -- I usually test via the wonderful |
SummaryHere are all my numbers:
Thoughts:
So, I'm good with this from an infrastructure / size standpoint. I'll leave you to @boygirl for a substantive evaluation. Thanks for this contribution! Base
$ cd builder-victory-component
$ git checkout master
$ cd ..
$ npm pack builder-victory-component
$ mv builder-victory-component-2.1.3.tgz builder-victory-component-master-2.1.3.tgz
$ npm pack builder-victory-component/dev
$ mv builder-victory-component-dev-2.1.3.tgz builder-victory-component-dev-master-2.1.3.tgz
$ cd victory
$ npm install
$ npm install \
../builder-victory-component-master-2.1.3.tgz \
../builder-victory-component-dev-master-2.1.3.tgz
$ builder run build-dist
$ cat dist/victory.js | wc -c
983180
$ cat dist/victory.js | gzip -c | wc -c
197954
$ cat dist/victory.min.js | wc -c
304265
$ cat dist/victory.min.js | gzip -c | wc -c
81565 PR
$ cd builder-victory-component
$ git checkout pr/59
$ cd ..
$ npm pack builder-victory-component
$ mv builder-victory-component-2.1.3.tgz builder-victory-component-pr59-2.1.3.tgz
$ npm pack builder-victory-component/dev
$ mv builder-victory-component-dev-2.1.3.tgz builder-victory-component-dev-pr59-2.1.3.tgz
$ cd victory
$ npm install
$ npm install \
../builder-victory-component-pr59-2.1.3.tgz \
../builder-victory-component-dev-pr59-2.1.3.tgz
$ builder run build-dist
$ cat dist/victory.js | wc -c
836806
$ cat dist/victory.js | gzip -c | wc -c
170474
$ cat dist/victory.min.js | wc -c
286025
$ cat dist/victory.min.js | gzip -c | wc -c
75620 Additional experiment: No
|
@okonet thanks for taking on this task! I will update the lodash imports across victory repos in the course of my work for the upcoming release (Friday). |
: / I just realized that |
Yeah we can drop 0.10 from Travis. But, this should only affect git installs of victory components, not installs from NPM, so we should perhaps update our docs with that nuanced guideline? |
Will do! |
This PR added 2
lodash
plugins in order to improve DX and reduce the file size.From now on it's possible to import
lodash
modules usingimport { map, filter } from "lodash"
syntax instead of cherry-picking them without size penalties.Also, the distributive file size is reduced by ~15%.
Before:
After: