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! ! !
PHPz2017-05-16 13:40:31
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
迷茫2017-05-16 13:40:31
You can use --ignore
或者--copy-file
parameters:
babel src -s -d dist --ignore src/app/*.js
--copy-file
I haven’t used it specifically, you can refer to
How to use the CLI tools