尝试为我的所有js文件进行通配符匹配,但是我收到了此错误
var elements = request.replace(/^-?!+/, "").replace(/!!+/g, "!").split("!");
^
TypeError: request.replace is not a function
at C:\Users\Superant-Laptop\Projects\seeties-webapp\node_modules\webpack\lib\NormalModuleFactory.js:72:27
这是我配置webpack文件的方式。
function toObject(paths) {
console.log(paths)
var ret = {};
paths.forEach(function(path) {
ret[path.split('/').slice(-1)[0]] = path;
});
return ret;
}
module.exports = {
entry: [
'webpack/hot/dev-server',
'webpack-hot-middleware/client',
toObject(glob.sync(path.join(__dirname, 'resources/assets/bundle/entries/*js')))
],
output: {
path: path.join(__dirname, 'public'),
publicPath: '/',
filename: 'app.js'
}
}
上面的webpack.config.js出了什么问题?它对我来说没问题。
答案 0 :(得分:1)
entries/*js
- > entries/*.js