node.js - babel directive how to skip translation of certain files?
仅有的幸福
仅有的幸福 2017-05-16 13:38:31
0
2
831

How can the babel command skip the translation of certain files?
Currently using:

babel src -s -D -d dist

.babelrc

{
  "presets": [
    "es2015",
    "stage-2"
  ],
  "plugins": [
      ["transform-runtime", {
        "polyfill": false,
        "regenerator": true
      }]
  ]
}

All files in src will be translated and saved to dist
Now you need to save the src/app files directly to dist without translation, while other files in src will still be translated.
Thanks! ! !

仅有的幸福
仅有的幸福

reply all(2)
PHPzhong

I have a question, why don’t you take a look babel --help

Option Default Description
-i, --ignore [regex] node_modules Ignore all files that match this regex when using the require hook
babel src -s -D -d dist --ignore src/app
迷茫

You can use --ignore或者--copy-fileparameters:

babel src -s -d dist --ignore src/app/*.js

--copy-fileI haven’t used it specifically, you can refer to
How to use the CLI tools

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template