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

Tree-shaking extension fails for non-named imports #1477

Closed
mjstahl opened this issue Nov 21, 2018 · 0 comments · Fixed by #1479
Closed

Tree-shaking extension fails for non-named imports #1477

mjstahl opened this issue Nov 21, 2018 · 0 comments · Fixed by #1479
Assignees

Comments

@mjstahl
Copy link
Contributor

mjstahl commented Nov 21, 2018

Assuming an imported file helpers/helpers.js that includes a handfull of imports like so:

// helpers/helpers.js
import 'a.js'
import 'b.js'

In a stache file, use can-import to import the helpers file

<!-- index.stache -->
<can-import from="~/helpers/" />

When loading that stache file the following error will occur.

screen shot 2018-11-21 at 9 06 58 am

This error occurs at

if(parentImportNames[parentSpecifier]) {
because parentImportNames (parentLoad.metadata.importNames) is undefined.

A work around for this is to name the imports.

// helpers/helpers.js
import A from 'a.js'
import B from 'b.js'
@mjstahl mjstahl added the bug label Nov 21, 2018
@matthewp matthewp self-assigned this Nov 27, 2018
matthewp added a commit that referenced this issue Nov 27, 2018
When re-walking the parent modules in order to perform tree-shaking,
	 account for the fact that there might be non-ES modules in the
	 tree.

Previously we were detecting non-ES modules in the "first pass" but not
latter passes that occur when more modules start being imported with
mutual dependencies.

Closes #1477
matthewp added a commit that referenced this issue Nov 27, 2018
When re-walking the parent modules in order to perform tree-shaking,
	 account for the fact that there might be non-ES modules in the
	 tree.

Previously we were detecting non-ES modules in the "first pass" but not
latter passes that occur when more modules start being imported with
mutual dependencies.

Closes #1477
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants