我的 webpack.config.js 有什么问题,因为它无法排除 node_modules。我在以前版本的 webpack 中发现了关于这个问题的类似帖子,但是由于语法不同,修复不起作用......
module.exports = {
context: __dirname,
entry: './src/index.js',
output: {
path: __dirname + '/public/assets/',
publicPath: '/assets/js/',
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.css$/,
include: /src/,
exclude: /node_modules/,
use: [
{loader: 'style-loader'},
{loader: 'css-loader'}
]
},
{
test: /\.ejs$/,
include: /src/,
exclude: /node_modules/,
use: [
{loader: 'ejs-simple-loader'}
]
},
{
test: /\.js$/,
include: /src/,
exclude: /node_modules/,
use: [
{loader: 'jshint-loader'}
]
},
{
test: /\.jsx$/,
include: /src/,
exclude: /node_modules/,
use: [
{loader: 'babel-loader'}
]
}
]
}
}