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

tivac
Copy link
Owner

@tivac tivac 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
@tivac tivac deleted the dynamic-imports-tree-shaking branch January 16, 2019 22:01
@TravisBuddy

This comment has been minimized.

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.

None yet

2 participants