【笔记】Rollup的PluginBabel插件

前言

Rollup通过PluginBabel插件实现JS语法降级

下载依赖

1
npm install -D @rollup/plugin-babel @babel/preset-env

修改配置文件

babel.config.js
1
2
3
4
5
module.exports = {
presets: [
"@babel/preset-env"
]
};
rollup.config.js
1
2
3
4
5
6
7
8
9
10
const { babel } = require("@rollup/plugin-babel");

module.exports = {
plugins: [
babel({
babelHelpers: "bundled",
exclude: "node_modules/**",
})
]
};

完成