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

Translate context when importing common JS modules. #31

Closed
CrowdHailer opened this issue Jan 13, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@CrowdHailer
Copy link

commented Jan 13, 2016

I have not done enough research on this problem to explain why so I will just start with an example.

import D3 from 'd3';

console.log(D3);

This code throws the error because the document object cannot be found on the this context.

This translator might need to set the global context of the import as the window as opposed to leaving it undefined per es6 modules.

Rich-Harris added a commit that referenced this issue Jan 18, 2016

Rich-Harris added a commit that referenced this issue Jan 18, 2016

Merge pull request #32 from rollup/gh-31
rewrite top-level this expressions
@Rich-Harris

This comment has been minimized.

Copy link
Contributor

commented Jan 18, 2016

Thanks – fixed in 2.2.0

@CrowdHailer

This comment has been minimized.

Copy link
Author

commented Feb 9, 2016

This example with D3 still does not work. I am using the latest version of Rollup and rollup-plugin-commonjs.

@airhorns

This comment has been minimized.

Copy link

commented Oct 12, 2016

@Rich-Harris this example is also still broken for me for requiring d3 version 3 from an npm module ... any suggestions?

    "rollup": "^0.36.3",
    "rollup-plugin-commonjs": "^5.0.5",
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.