babel入门系列之babel-cli命令行

babel-cli命令行

	安装:"@babel/cli": "^7.7.7", "@babel/core": "^7.7.7",
    1. -d,--out-dir [out] 指定输入目录,编译输出到指定目录
        npx babel src -d lib
    2. --source-maps [true,false,inline,both] 增加source map文件
        npx babel src -d lib --source-maps
    3. -o,--out-file [out] 指定输入文件或目录,合并编译输出到一个新文件
        npx babel index.js -o compile.index.js
    4. -w,--watch 监听文件修改并执行编译
        npx babel src -d lib --source-maps --watch
    5. --ignore 忽略指定正则文件
        npx babel src -d lib --source-maps --ignore "node_modules/**/*.js"
    6. --copy-files 拷贝文件(可通过其方式实现)
        npx babel src -d lib --copy--files
    7. 通过管道输入文件
        npx babel src -o compiled.js<index.js -f index.js --source-maps
    8. --plugins 使用插件
        npx babel src -d lib --plugins=@babel/plugin-transform-arrow-functions
    9. --presets 预设
        npx babel src -d lib --presets=@babel/preset-env 
    10. --no-babelrc 忽略.babelrc,并通过命令行参数执行构建流程
        npx babel --no-babelrc src -d lib --plugins=@babel/plugin-transform-arrow-functions
    11. 自定义配置文件路径
        npx babel --config-file /path/to/my/babel.config.json --out-dir dist ./src
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值