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

fix: limit import() rewrites #547

Merged
merged 2 commits into from Jan 21, 2019

Conversation

Projects
None yet
1 participant
@tivac
Copy link
Owner

commented Jan 21, 2019

Description

Don't try and rewrite import() statements if the chunk doesn't have any assets that need loading.

Motivation and Context

Don't want to bloat up bundles with useless code, and @modular-css/rollup only tags bundle with .assets when they actually have assets. Can lead to errors when rollup-rewriter tries to call assets.map and assets is undefined.

How Has This Been Tested?

Tests! Also ran it against a big project that first surfaced this behavior.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

tivac added some commits Jan 21, 2019

fix: only rewrite import() when necessary
If the chunk doesn't have any assets there's no point trying to rewrite it and exploding.
@codecov

This comment has been minimized.

Copy link

commented Jan 21, 2019

Codecov Report

Merging #547 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #547      +/-   ##
==========================================
+ Coverage   99.02%   99.02%   +<.01%     
==========================================
  Files          46       46              
  Lines        1027     1028       +1     
  Branches      157      158       +1     
==========================================
+ Hits         1017     1018       +1     
  Misses         10       10
Impacted Files Coverage Δ
packages/rollup-rewriter/rewriter.js 100% <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 1b5f77a...a18ce00. Read the comment docs.

@tivac tivac merged commit 32e58e6 into master Jan 21, 2019

4 checks passed

codecov/patch 100% of diff hit (target 99.02%)
Details
codecov/project 99.02% (+<.01%) compared to 1b5f77a
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@tivac tivac deleted the limit-rewrites branch Jan 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.