/node_modules/webpack/lib/TemplatedPathPlugin.js:72
.replace(REGEXP_HASH, withHashLength(getReplacer(data.hash), data.hashWithLength))
^
运行webpack
时,我遇到了这个错误——看起来path
是一个对象而不是一个字符串,因此找不到替换方法。有谁能解释一下这个错误吗?下面是我的webpack.config.js
文件:
var webpack = require('webpack');
var path = require('path');
var basePath = 'app';
var outputFile = 'output.js';
var config = {
entry: basePath + '/index.js',
output: {
path: basePath,
filename: outputFile
},
resolve: {
extensions: ['', '.js']
},
module: {
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
}]
}
};
module.exports = config;