javascript - TypeError: path.replace is not a function -
/node_modules/webpack/lib/templatedpathplugin.js:72 .replace(regexp_hash, withhashlength(getreplacer(data.hash), data.hashwithlength)) ^
i'm getting error when running webpack
- seems path
object rather string, , replace method therefore not found. can shed light on error? here's 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 plugin configuration. webpack 2 changes extracttextplugin slightly. expects parameters come wrapped in object, first parameter value of filename
on object rather 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 readme
Comments
Post a Comment