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

Babel picks up translations in ignored folder #7070

Closed
mathieudevos opened this issue Dec 20, 2017 · 4 comments
Closed

Babel picks up translations in ignored folder #7070

mathieudevos opened this issue Dec 20, 2017 · 4 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@mathieudevos
Copy link

mathieudevos commented Dec 20, 2017

Bug report

Babel is running translations on files which are inside ignored folder(s)

Expected Behavior

Ignore everything inside ignored folder(s)

Current Behavior

Babel translates items inside the folder if it finds things that tell babel to translate is

Possible Solution

Properly ignore folders, don't even check inside them

Context

Cross-linking reference: hawk#277

Basically we have our src folder in our repo, and our dist repo (uncommitted). The build server runs yarn in the src folder, runs all unit tests inside of it.
If this completes it runs babel translation with the following .babelrc

{
  "ignore": [
    "node_modules",
    "test"
  ],
  "plugins": [
    "transform-async-to-generator",
    "transform-runtime"
  ],
  "presets": ["es2015"]
}

However, taking a look in my build server, I can see the following log:

src/folder1/handler.js -> dist/folder1/handler.js
src/folder2/handler.js -> dist/folder1/handler.js
...
src/node_modules/hawk/client.js -> dist/node_modules/hawk/client.js
src/node_modules/hawk/dist/browser.js -> dist/node_modules/hawk/dist/browser.js
src/node_modules/hawk/lib/browser.js -> dist/node_modules/hawk/lib/browser.js
src/node_modules/hawk/lib/client.js -> dist/node_modules/hawk/lib/client.js
src/node_modules/hawk/lib/crypto.js -> dist/node_modules/hawk/lib/crypto.js
src/node_modules/hawk/lib/index.js -> dist/node_modules/hawk/lib/index.js
src/node_modules/hawk/lib/server.js -> dist/node_modules/hawk/lib/server.js
src/node_modules/hawk/lib/utils.js -> dist/node_modules/hawk/lib/utils.js
...
src/folder_last/index.js -> dist/folder_last/index.js

Hawk has the following items which (I think) is causing this issue:
.babelrc

Hawk already has said they will not fix this issue, and technically, this is a babel issue imho.

@babel-bot
Copy link
Collaborator

Hey @mathieudevos! 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.

@therobinkim
Copy link

According to #5664 (comment), it looks like it's fixed in Babel 7.x.

Related: #4708 (comment)

@carlevans719
Copy link

I've just hit a problem caused by this in 7.0.0-beta.40.

I have configured the node_modules folder to be ignored in my project's .babelrc, but babel-cli is throwing an exception because it is finding duplicate configs inside one of my installed node modules (esrecurse).

I expected that, because node_modules is ignored, that the files inside it would not be scanned at all, however, from looking through the debug output and the code, it appears that the ignore is only being applied after the check for duplicate configs.

This strikes me as a redundant check because we know that we'll never parse/transpile files anyway so (I think) that duplicate configs won't matter to me. Rather, they are only the concern of the module author, or developer who doesn't ignore their node_modules folder.

I'm aware that there is ongoing? discussion about how hierarchical .babelrcs (or synonymous configs) should be handled in #6766. But if the current behaviour is undesired I'd be happy to raise a PR to either:

  • only check for duplicate configs if the folder in question hasn't been ignored, or
  • not scan ignored folders in the first place

If needed I can get a repro up tomorrow evening.

@loganfsmyth
Copy link
Member

I think Babel 7 addresses most of these complaints since .babelrc files are never accessed across node_modules borders, and babel.config.js files provide a way to have project-level configs that affect whatever files you need.

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Nov 11, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Nov 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

5 participants