Skip to content

--no-copy-ignored only ignores .js files and does not enforce config "ignore:" settings #11394

@thedavidprice

Description

@thedavidprice

Bug Report

Current Behavior
When using babel cli with --copy-files --no-copy-ignored, files and directories configured in my babel.config.js ARE copied into my build directory (with the exception of specified file types ending in .js). To be clear:

  • there are no included files with names including test.js
  • there are included files with names including test.ts
  • there are included directories named __tests__
  • there are included directories named __mocks__

Input Code

"package.json" build script:
babel src -d dist --delete-dir-on-start --copy-files --no-copy-ignored

Expected behavior/code
When running yarn build, I expect babel to build my files and output to the "dist/" directory. The build will include non-js files because I am using the flag --copy-files, for example, template files ending in .template. The build will not include directories and files from the babel.config.js "ignore" list because I am using --no-copy-ignored:

  • directory __tests__
  • directory __mocks__
  • files with name including test.js
  • files with name including test.ts

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)

  • Filename: babel.config.js
{
  ...
  ignore:
     [
          /\.test\.(js|ts)/,
          '**/__tests__',
          '**/__mocks__',
     ]
}

Environment

  System:
    OS: macOS 10.15.4
  Binaries:
    Node: 12.16.0 - ~/.nvm/versions/node/v12.16.0/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v12.16.0/bin/npm
  • Monorepo: Lerna
  • How you are using Babel: cli

Possible Solution
I have tried using --ignore, which also does NOT work. I suspect the --no-copy-ignored flag has a bug.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions