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

browserify applies transforms to npm linked modules #1386

Closed
jayphelps opened this issue Sep 21, 2015 · 15 comments
Closed

browserify applies transforms to npm linked modules #1386

jayphelps opened this issue Sep 21, 2015 · 15 comments

Comments

@jayphelps
Copy link

If you npm link a module into your browserify project, it incorrectly has transforms applied to it. This becomes a major issue particularly if the module you install relies on non-strict mode and you're using babelify, which inserts "use strict", causing it to error.

Here's a repo to reproduce: https://github.com/jayphelps/browserify-bug. The major step to note in the README is that you must git clone the external module and npm link it for the bug to show.

Also note that very new versions of babel proactively transform certain strict mode code, like this.foo to undefined.foo. Don't let this confuse you.

@jmm
Copy link
Collaborator

jmm commented Sep 21, 2015

Hmm, I wonder if this could be from #1318.

@jayphelps
Copy link
Author

Cc/ @chrisirhc

@jmm
Copy link
Collaborator

jmm commented Sep 23, 2015

Maybe related: #1365.

@chrisirhc
Copy link
Contributor

Definitely sounds like it's related to #1365. Thanks for narrowing it down. If nobody else gets to this, I'll look into it later today.

@ivantsepp
Copy link

Ah thanks for linking me to this issue @jmm!

This matches the behavior I'm seeing. The babel transform is being applied to a symlinked node_module when it shouldn't be.

@chrisirhc
Copy link
Contributor

I've come up with a quick hackish solution to resolve this (browserify/module-deps#99, #1392). It's up for comment and review.

@reverofevil
Copy link

Is there any workarounds for this issue except hand-patching node_modules? Build of my project fails because of this.

@jayphelps
Copy link
Author

switch to webpack :trollface:

@reverofevil
Copy link

I've thought about it for a long time :trollface:

@jmm
Copy link
Collaborator

jmm commented Oct 1, 2015

Off with your heads!

@polkovnikov-ph I'm still working from the assumption that this is a result of #1318. Could you downgrade to browserify@<10.2.5 for now if that resolves it? As you wrote in the other issue, Babel's ignore option is another possibility, but that could get messy.

@chrisirhc
Copy link
Contributor

@jmm, it is caused by #1318. I've submitted a fix for this as I mentioned above.

@jmm
Copy link
Collaborator

jmm commented Oct 2, 2015

@chrisirhc Ok, thanks for confirming and for the PR. I haven't had a real good look at either #1318 or the new PR and I hadn't seen you say whether or not it had resulted from #1318, so I wasn't sure.

@ghost
Copy link

ghost commented Oct 28, 2015

This is fixed in 12.0.1.

@ghost ghost closed this as completed Oct 28, 2015
kintel added a commit to anyWareSculpture/sculpture-client that referenced this issue Nov 16, 2015
kintel added a commit to kintel/node-browserify that referenced this issue Nov 19, 2015
@kintel
Copy link
Contributor

kintel commented Nov 19, 2015

@substack See #1437 - I believe this should be reopened.

@TehShrike
Copy link
Contributor

I encountered this issue when using browserify 12.0.1.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

7 participants