Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Translate context when importing common JS modules. #31

Closed
CrowdHailer opened this issue Jan 13, 2016 · 3 comments · Fixed by #32
Closed

Translate context when importing common JS modules. #31

CrowdHailer opened this issue Jan 13, 2016 · 3 comments · Fixed by #32

Comments

@CrowdHailer
Copy link

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
rewrite top-level this expressions
@Rich-Harris
Copy link
Contributor

Thanks – fixed in 2.2.0

@CrowdHailer
Copy link
Author

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

@airhorns
Copy link

@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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants