Skip to content
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

Bundle helmet using rollup #395

Merged
merged 3 commits into from Dec 4, 2018
Merged

Bundle helmet using rollup #395

merged 3 commits into from Dec 4, 2018

Conversation

realityking
Copy link
Contributor

This PR adds rollup to bundle helmet into a single module for CJS and ESM.

The main advantage is smaller code size (about 8% for the CommonJS version) due to inlined exports and deduplicated babel helpers. It will also improve start up time a little bit when bundling the CommonJS version with Webpack, as it creates a function invocation for every module.

Lastly, this help minifies and optimisers more easily see the code paths taken and allow them to drop/inline more things when bundling.

Note that this will be braking change:

  • The file structure changed and you can't deep require the utils and constants anymore
  • I removed the default export from Helmet.js as it doesn't work well with rollup. It also seems unnecessary since all documentation is using the named export.

@CLAassistant
Copy link

CLAassistant commented Aug 25, 2018

CLA assistant check
All committers have signed the CLA.

@realityking
Copy link
Contributor Author

The test failure is unrelated to this change. Fix in #397.

@tmbtech
Copy link
Contributor

tmbtech commented Nov 2, 2018

@realityking Thank you for this PR, this one makes sense to me. I'll review and get back to you early next week. Sorry for the delay, I'm going to be jumping in for Chris.

@tmbtech tmbtech self-requested a review November 2, 2018 03:32
@tmbtech tmbtech self-assigned this Nov 2, 2018
@tmbtech
Copy link
Contributor

tmbtech commented Nov 5, 2018

@realityking quick update. I talked with @cwelch5 over the weekend and we are both like the idea of moving to rollup. The plan is to test internally, bumping a major version, then npm publishing a beta version for feedback. It's going to take a little bit to get all this formalized, but we are making good progress.

@realityking
Copy link
Contributor Author

Great to see helmet coming back to life :) I've rebased on top of master and updated all the rollup related dependencies.

@tmbtech
Copy link
Contributor

tmbtech commented Nov 14, 2018

@realityking doesn't look like travis / node v4 likes the latest branch. Let me find out if node 4, is still a requirement, or if we can take it out of the build step.

@tmbtech
Copy link
Contributor

tmbtech commented Nov 14, 2018

According to this link, https://github.com/nodejs/Release, 4 is EOL. We should remove it from the travis build checks.

@tmbtech
Copy link
Contributor

tmbtech commented Nov 14, 2018

#414

@codecov
Copy link

codecov bot commented Nov 24, 2018

Codecov Report

Merging #395 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #395   +/-   ##
======================================
  Coverage    97.6%   97.6%           
======================================
  Files           3       3           
  Lines         292     292           
======================================
  Hits          285     285           
  Misses          7       7
Impacted Files Coverage Δ
src/Helmet.js 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1803f67...7916d69. Read the comment docs.

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.

None yet

3 participants