-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
@babel/node not recognizing ignores from babel.config.js when running babel-node #11892
Comments
Hey @jcreamer898! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite." |
For what it's also worth I finally got an ignore regex to work on the command line as well, just took me a while to get it right... babel-node --ignore '\/node_modules\/(?!my-npm-pkg)\/' index.js |
Can you update the second screenshot? You included the same screenshot twice... |
Oops, sorry, sec. |
Fixed. |
Not sure if I understand correctly but shouldn't Because running it with the
|
I played around with your ignore: [function(filepath, ctx) {
console.log(filepath); // only prints my-npm-pkg
return true;
}] ignore: [function(filepath, ctx) {
console.log(filepath); // only prints my-npm-pkg
return false;
}] |
Right, exactly, it's like it doesn't work at all when the config file is being used. I think the "default" --ignore is taking over whatever is in the babel config. |
I have the same issue, the |
Bug Report
Current behavior
It's possible it's a "feature", but seems like a bug.
So, I have a babel config that has an ignore function in it. Mostly because where I work we have a couple of internal node modules we publish that have some
dist
folders withimport
export
statements.The
babel.config.js
looks more or less like this...When I run the following...
I get the following error...
However, if I run it with an empty ignore, like this...
babel-node --ignore ' ' ./index.js
Everything works...
Expected behavior
I'd expect that the ignore should be taken from the
babel.config.js
even if I don't have an--ignore
in the command line args.Environment
I'm running on node 12.17.0.
I also created an example repository here...
https://github.com/jcreamer898/babel-node-ignore
Possible Solution
I'm not entirely sure, but maybe it has something to do with https://github.com/babel/babel/blob/main/packages/babel-register/src/node.js#L140?
Does there need to be a check for the babel config's ignore here? It didn't seem like that to me because when I console logged the options getting passed here, it didn't even seem to have the ignore from my
babel.config.js
.https://github.com/babel/babel/blob/main/packages/babel-node/src/_babel-node.js#L94
So, my suspicion is that the
--ignore ' '
is just nuking the ignore option totally, andbabel.config.js
is firing on a file by file basis later on as they're processing individual files?The text was updated successfully, but these errors were encountered: