Skip to content

Better mapbox minification fix#2792

Merged
etpinard merged 8 commits into
masterfrom
better-mapbox-minification-fix
Jul 11, 2018
Merged

Better mapbox minification fix#2792
etpinard merged 8 commits into
masterfrom
better-mapbox-minification-fix

Conversation

@etpinard

@etpinard etpinard commented Jul 9, 2018

Copy link
Copy Markdown
Contributor

fixes #2787, though I wouldn't call it a great fix, but it's probably the best we can do in this repo.

By playing around with terser's compression options (which is the default minifier in our dev-dep minify-stream), I found that setting typeofs: false on bundles that include mapbox-gl fixes #2789. Moreover, I added a test to make sure this doesn't happen again.

With this PR our bundle sizes are back to where they were before #2789.

@etpinard

etpinard commented Jul 9, 2018

Copy link
Copy Markdown
Contributor Author

cc @alexcjohnson

@alexcjohnson

Copy link
Copy Markdown
Collaborator

Good find! While we’re at it, would it be worth including all trace types in that test? The plot_types mock is a good start, but also may be nice to include parcoords, sankey, table, scattergl...

Also, is it possible to base this flag on whether mapbox is in the bundle definition, rather than naming specific bundles? I wouldn’t want to have to remember this if we add another that includes mapbox. Or should we just leave this option in all bundles? Does it add a noticeable number of bytes? Anyway it says IE10 and below might not like this compression so it may be best to just make it consistent.

etpinard added 3 commits July 9, 2018 16:54
- for consistency and maintainability,
  this does lead to a few extra bytes though.
... for better min.js test coverage
@etpinard

etpinard commented Jul 9, 2018

Copy link
Copy Markdown
Contributor Author

The plot_types mock is a good start, but also may be nice to include parcoords, sankey, table, scattergl...

I hope you like dd8bf6c and 89d7aa8 where I reused the Plotly.react noop test lists. Let's just hope it doesn't add too much time to our CI test runs 🤞

Or should we just leave this option in all bundles? Does it add a noticeable number of bytes?

That's what I went for in the end in 2a3afe7. I find the maintainability gains very nice here. It does adds a few bytes (noticeable in some but not all bundles). For reference, in red is with typeofs compression sizes, in green is w/o:

image

@alexcjohnson

alexcjohnson commented Jul 10, 2018

Copy link
Copy Markdown
Collaborator

😍 love it! Funny that in at least one case (Cartesian) minified is bigger but gzipped is smaller this way!?
💃

etpinard added 3 commits July 10, 2018 11:05
- to improve log readability
- to keep cpu levels somewhat constant throughout run
Comment thread .circleci/test.sh

jasmine)
npm run test-jasmine -- --skip-tags=gl,noCI,flaky || EXIT_STATE=$?
npm run test-bundle || EXIT_STATE=$?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which gives:

image

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚖️ 👍
💃 still applies :)

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

Successfully merging this pull request may close these issues.

Mapbox subplots are broken in minified bundles

2 participants