修改如下:
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude:__dirname+'node_modules',
include:__dirname+'src',
options: {
presets: ['env']
}
}
]
}
或是:
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude:path.resolve(__dirname,'/node_modules'),
include:path.resolve(__dirname,'/src'),
options: {
presets: ['env']
}
}
]
}
时间有点差异,还不知道哪一个更好,好像差不多,或者是path.join()?学习的是慕课网webpack视频,webpack视频版本是1.x,现在用的是4.29.0