table of Contents
Use babel7 transcoding
Need to install something in advance:
- npx easy to execute commands
{
"name": "TestBabel7",
"version": "1.0.0",
"dependencies": {
"@babel/polyfill": "^7.6.0"
},
"devDependencies": {
"@babel/cli": "^7.6.4",
"@babel/core": "^7.6.4"
}
}
babel.config.js Configuration
const presets = [
[
"@babel/env",
],
];
const plugins = [
["@babel/plugin-proposal-decorators", { "legacy": true }], // 装饰器
];
module.exports = { presets,plugins};
Conversion of command
Such as: js directory under the file conversion is stored to the src directory
npx babel js -d src