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: don't explode when dynamic imports are removed by tree-shaking #538

Merged
merged 3 commits into from Jan 16, 2019

Conversation

Projects
None yet
2 participants
@tivac
Copy link
Owner

commented Jan 16, 2019

Description

Working around rollup/rollup#2659

Motivation and Context

Without this change if you have any dynamic imports in your codebase that can be dropped by treeshaking you'll get JS errors like the following:

[!] (@modular-css/rollup plugin) TypeError: Cannot destructure property `modules` of 'undefined' or 'null'.
TypeError: Cannot destructure property `modules` of 'undefined' or 'null'.
    at usage.overallOrder.forEach (node_modules\@modular-css\rollup\rollup.js:199:68)
    at Array.forEach (<anonymous>)
    at Object.generateBundle (node_modules\@modular-css\rollup\rollup.js:196:34)
    at \node_modules\rollup\dist\rollup.js:16609:25

How Has This Been Tested?

Added specimens and a test to the rollup code-splitting tests to ensure it no longer throws an error.

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 tivac self-assigned this Jan 16, 2019

@tivac tivac merged commit c2a09e1 into master Jan 16, 2019

3 of 4 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
codecov/patch Coverage not affected.
Details
codecov/project No report found to compare against
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@tivac tivac deleted the dynamic-imports-tree-shaking branch Jan 16, 2019

@TravisBuddy

This comment was marked as outdated.

Copy link

commented Jan 16, 2019

Hey @tivac,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: 4cd9fc30-19da-11e9-b6ef-27c2ed554f09
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.