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

intercept does not work with babel-register #29

Open
Poetro opened this issue Feb 29, 2016 · 1 comment
Open

intercept does not work with babel-register #29

Poetro opened this issue Feb 29, 2016 · 1 comment

Comments

@Poetro
Copy link

Poetro commented Feb 29, 2016

When using with babel-register the intercept hook kills the registration for babel, so no babel compilation happens, resulting in error

of define !== 'function') {var define = require('amdefine')(module)}import ok
                                                                    ^^^^^^
SyntaxError: Unexpected reserved word
@Poetro Poetro changed the title intercept does not work with babel_register intercept does not work with babel-register Feb 29, 2016
@jrburke
Copy link
Owner

jrburke commented Mar 1, 2016

That is definitely a hazard with using amdefine/intercept -- it is a very global, coarse tool, that may not be appropriate for some dependencies. Local amdefine used in the modules that need it is the more robust route.

I can look at not doing the injection if import/export are present, but may just be moving the problem for you. If there is no define() injected, if you are using an AMD loader to load the code, then that will not work -- the module may get converted to ES5 format by babel, but since it will not be calling define(), seems like the module will not end up in the AMD loader registry?

Could you give some more detail on the use case, if not touching ES2015 import/export modules will help it?

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

No branches or pull requests

2 participants