-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
copy-files flag does not respect ignore block in .babelrc #6226
Copy link
Copy link
Labels
outdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: cli
Description
Bug: If in your build script, you have --copy-files passed, files that are ignored in .babelrc files will be copied over, instead of being ignored.
Input Code
babel src --out-dir lib --copy-filesBabel Configuration (.babelrc, package.json, cli command)
{
"presets": [
"es2015",
"stage-1",
"react"
],
"ignore": [
"**__mocks__/*.js"
]
}Expected Behavior
Babel should not copy files that are explicitly ignored in .babelrc configuration. In this case, babel should not transpile or copy Jest mocks.
Current Behavior
Babel copies files that are ignored are explicitly .babelrc.
> npm run build
> babel src --out-dir lib --copy-files
src/api/__mocks__/index.js -> lib/api/__mocks__/index.js
src/api/endpoints.js -> lib/api/endpoints.jsIf you pass an --ignore flag (with the same blob) after the --copy-files flag, it will behave as expected.
> npm run build;
> babel src --out-dir lib --copy-files --ignore **__mocks__/*.js
src/api/endpoints.js -> lib/api/endpoints.js
(output does not include ignored directories)Context
This issue comes up when you work with Jest manual mocks inside of your source directory. Jest warns that you have duplicate mocks directories.
| software | version(s) |
|---|---|
| Babel | 6.26.0 |
| node | 6.9.2 |
| npm | 5.4.0 |
| Operating System | OSX El Capitan |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
outdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: cli