/node_modules/webpack/lib/TemplatedPathPlugin.js:72
.replace(REGEXP_HASH, withHashLength(getReplacer(data.hash), data.hashWithLength))
^
ich diesen Fehler, wenn webpack
läuft - es scheint, dass path
ist ein Objekt eher als eine Zeichenfolge, und das ersetzen Methode ist daher nicht gefunden. Kann jemand diesen Fehler aufklären? Hier ist mein webpack.config.js
:Typeerror: path.replace ist keine Funktion
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;
Ich glaube, Sie haben Ihre Konfiguration exportieren: module.exports = require ('webpack. config.js ') –
[Docs] (http://webpack.github.io/docs/configuration.html#output-path) "output.path Das Ausgabeverzeichnis als absoluter Pfad (erforderlich)." –