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

Compiling code that uses library installed via npm link failes #117

Closed
reverofevil opened this issue Oct 1, 2015 · 7 comments
Closed

Compiling code that uses library installed via npm link failes #117

reverofevil opened this issue Oct 1, 2015 · 7 comments

Comments

@reverofevil
Copy link

When doing a babelify transform after some previous transform on the sources that include some library via npm link, and if that library contains something like Object.keys, babelify makes build fail due to missing babel-runtime properties.

 watchify ... -t reactify -t [ babelify  --optional "runtime" ] ...

 Error: Cannot find module 'babel-runtime/core-js/object/keys' from '...\thrift\lib\nodejs\lib\thrift'

While if the library is reinstalled via npm install and it still contains Object.keys, it works OK.

The part of the message from ... doesn't point to an exact file, but to the whole library folder, and that doesn't seem like a correct behaviour also, because it takes time to look through all the sources of the library to find that Object.keys.

Also I don't understand why babelify even starts transforming that library, because default browserify behaviour for -t is to transform all the sources except libraries.

@jmm
Copy link
Member

jmm commented Oct 1, 2015

I think these are browserify issues that just happen to be visible via babelify. See:
browserify/browserify#1386
browserify/browserify#1365

The part of the message from ... doesn't point to an exact file, but to the whole library folder, and that doesn't seem like a correct behaviour also

Couldn't agree more. I've been trying to fix that:
browserify/resolve#60
browserify/resolve#64

@reverofevil
Copy link
Author

Okay, there seems to be a workaround. babelify has --ignore <regex> flag. To get rid of these errors I just have to put two folders there. Single folder name works well, but passing a|b regex is not possible, because | is a special char in command line. If I put it like "a|b", neither directory gets ignored. What am I doing wrong?

@jmm
Copy link
Member

jmm commented Oct 1, 2015

@polkovnikov-ph What's your browserify version?

@reverofevil
Copy link
Author

@jmm
watchify v3.2.3
browserify v10.2.6

@jmm
Copy link
Member

jmm commented Oct 1, 2015

@polkovnikov-ph Thanks. Not sure about your ignore pattern -- could you try '{a,b}' and see what happens?

@zertosh
Copy link
Member

zertosh commented Oct 31, 2015

@polkovnikov-ph are you still having this problem?

@velomash
Copy link

velomash commented Nov 6, 2015

I was experiencing this bug with babelify + browserify: "3.0.0". I upgraded browserify to "^4.0.1" and it was solved. You can probably close this.

@zertosh zertosh closed this as completed Nov 7, 2015
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

4 participants