-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
babelrc is not read when using babelify #151
Comments
Further investigation reveals that when I supply So this reads in babelrc: "browserify": {
"transform": [
[
"babelify"
],
"envify"
]
}, This does not: "browserify": {
"transform": [
[
"babelify",
{
"sourceMapRelative": "true"
}
],
"envify"
]
}, I believe the expected behavior is that the options are merged, especially if no babel-specific options are provided via transform config. Or am I misinterpreting? |
Yeah, it's a bug with |
Does that mean babelrc is supposed to work (pending bugfixes)? If so it would be good to mention that in the readme |
babelrc works. it's |
in that case can the readme be updated to mention that babel config is read automatically from .babelrc and package.json (?) as usual with babel, and if you want to manually override it at runtime you can also do that? currently it only mentions the manual runtime override technique, implying that's the preferred/only way to configure babelify. |
sure? It is ambiguous somewhere that normal babel behavior doesn't apply when using babelify? |
I think it's a bit surprising for a browserify transform to read options from the file system (not counting |
I don't think it's obvious babelify would look for babelrc. Not so obvious it doesn't need mentioning, anyway. Especially as there's a big section about different browserify-specific ways to configure it, but there's no mention that the standard Babel way works fine too. |
@zertosh thanks for the tip regarding sourceMapRelative. Removing that worked! I agree it's not obvious that babelify (via babel) reads babelrc, since most libraries in my experience don't read configuration from the file system unless it's run as a command line tool. In this case, I'm very glad babelify and babel behave this way, because it allows for my configuration to exist in only one place. Especially for things like npm scripts and node-babel. Thanks for responding so quickly! |
Awesome, was looking for that. Is it somehow possible to change the name from |
@queckezz Any option that you pass babelify gets passed to babel. So if that's a CLI only option, then it won't work. I didn't know that option existed, nor do I see it in the CLI package. |
@zertosh Right, thanks! I'm sorry for the noise. The option |
It appears that something is preventing babel from reading in the local .babelrc when running via babelify. Here is a gist that demonstrates the problem: https://gist.github.com/kirbysayshi/c0df1bf8bbbac53d0c1c
If I place the
presets
key within the package.json browserify config, then the code compiles just fine. I believe this worked before babel 6, so perhaps it's an upstream bug. Not sure.The text was updated successfully, but these errors were encountered: