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

feat: add rollup-rewriter package #545

merged 21 commits into from Jan 21, 2019

feat: add rollup-rewriter package #545

merged 21 commits into from Jan 21, 2019


Copy link

@tivac tivac commented Jan 20, 2019


Adds @modular-css/rollup-rewriter, a new package that can be used in conjunction with @modular-css/rollup in order to ensure that any dynamic chunks load all their CSS before they load themselves. This prevents a FOUC and helps to keep things fast-by-default.

Motivation and Context

Check out this twitter thread:

How Has This Been Tested?

The tests in the PR, as well as a prototype version I used on a project I've been working on. It seems to mostly work?

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)


  • 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 tivac added the feature label Jan 20, 2019
@tivac tivac self-assigned this Jan 20, 2019
Copy link
Owner Author

@tivac tivac commented Jan 20, 2019

Here's an example of what this package can do.

+import lazyload from "./css.js";
var css = {
    "b": "e b"

function b$1() {
+    Promise.all([
+    lazyload("./assets/chunk.css"),
+    import('./chunk.js')
+.then((results) => results[results.length - 1]).then(console.log);
-    import('./chunk.js').then(console.log)

export default b$1;


Copy link

@codecov codecov bot commented Jan 20, 2019

Codecov Report

Merging #545 into master will decrease coverage by 0.14%.
The diff coverage is 97.43%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #545      +/-   ##
- Coverage   99.17%   99.02%   -0.15%     
  Files          41       46       +5     
  Lines         971     1027      +56     
  Branches      149      157       +8     
+ Hits          963     1017      +54     
- Misses          8       10       +2
Impacted Files Coverage Δ
packages/rollup/rollup.js 100% <100%> (ø) ⬆️
packages/rollup-rewriter/rewriter.js 100% <100%> (ø)
packages/test-utils/rollup-build-snapshot.js 100% <100%> (ø)
packages/rollup-rewriter/formats/es.js 100% <100%> (ø)
packages/rollup-rewriter/formats/amd.js 88.88% <88.88%> (ø)
packages/rollup-rewriter/formats/system.js 88.88% <88.88%> (ø)
... and 1 more

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 935cd43...1df01f9. Read the comment docs.


@tivac tivac merged commit b483ed6 into master Jan 21, 2019
2 of 4 checks passed
@tivac tivac deleted the rollup-rewriter branch Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant