/node_modules/webpack/lib/TemplatedPathPlugin.js:72
.replace(REGEXP_HASH, withHashLength(getReplacer(data.hash), data.hashWithLength))
^
I'm getting this error when running webpack
- it seems that path
is an object rather than a string, and the replace method is therefore not found. Can anyone shed light on this error? Here's my 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;
Check your plugin configuration. Webpack 2 changes the ExtractTextPlugin slightly. It expects all parameters to come wrapped in an object, so your first parameter is now the value of filename
on that object rather than a string.
Webpack 1 way:
new ExtractTextPlugin('[hash].css', {allChunks: true, disable: false}),
Webpack 2 way:
new ExtractTextPlugin({filename: '[hash].css', allChunks: true, disable: false}),
More info in the README
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With