Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 1.05 KB

2019-01-03-babel-7-cli-ignore-syntax.md

File metadata and controls

19 lines (13 loc) · 1.05 KB

Thought it might be useful to note here for future reference, when the blog post was written it showed how to ignore files using babel 6. However with babel 7 the syntax for ignoring files from the CLI has changed slightly,

  • still uses the glob format
  • it needs to be in between brakets '
  • comma separated for multiple instances, but without spaces
  • avoid using --copy-files as this includes non transpiled files.

See example below of the npm script I use in package.json - npm run build:component

  "build:component": "rimraf dist && NODE_ENV=production babel src/lib  --out-dir dist --ignore '**/*__tests__,**/*.spec.js,**/*.test.js,**/*__snapshots__,**/*.sample.js,**/*.sample.json,/**/example-usage.js'" ,

rimraf

problem is that there is a bug in babel 7, that if you add --copy-files then ignore flag doesn't work. This means that either you ignore the files like test etc.. or you skip adding non js files such as css or json.

there might be plugin loaders workaround to add css and json but tbc