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
Merged

fix: limit import() rewrites #547

merged 2 commits into from
Jan 21, 2019

Conversation

tivac
Copy link
Owner

@tivac tivac 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.

If the chunk doesn't have any assets there's no point trying to rewrite it and exploding.
@codecov
Copy link

codecov bot 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
@tivac tivac deleted the limit-rewrites branch January 21, 2019 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant