webpack.config.js中 entry: babel-polyfill 改为 @babel/polyfill
app: ['@babel/polyfill', path.join(process.cwd(), 'src/main.js')],
module.rules中,对js的处理
function resolve(dir) {
return path.join(process.cwd(), dir);
}
const initBabelInclude = [
resolve('src'),
resolve('test'),
resolve('node_modules/pl-table'),
resolve('node_modules/vue-awesome'),
resolve('node_modules/element-ui/src/'),
resolve('node_modules/bpmn-js-properties-panel'),
];
{
test: /\.js$/,
loader: 'babel-loader',
include: babelInclude,
},
移除.babelrc文件,新增babel.config.js文件 // 使用js来配置,这是重点??!!!
module.exports = {
presets: [
['@babel/preset-env',
{
useBuiltIns: 'usage',
corejs: 2,
},
],
'@vue/babel-preset-jsx',
],
plugins: [
['import', {
libraryName: 'antd',
libraryDirectory: 'lib',
}],
],
};
|