bendrucker / proxyquire-universal

Proxyquire in Node and Proxyquireify in the browser with no code changes
MIT License
35 stars 5 forks source link

ES6 compatibility #19

Closed 1v4nx closed 7 years ago

1v4nx commented 7 years ago

Currently, the transformation only works with require('proxyquire') statements, not with import proxyquire from 'proxyquire' ones.

Also, mixing both require and import statements on a single file seems to break with SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' error. Though, that seems to be an issue with proxyquireify's browserify plugin.

bendrucker commented 7 years ago

How is an import statement supposed to work in the first place? Browserify isn't going to handle import keywords either so I don't see how this is specific to this plugin. Those statements need to be transpiled to require to actually work.

bendrucker commented 7 years ago

Closing b/c none of this seems proxyquireify related. That error you shared is from babel.