1
Ich habe ein seltsames Problem, das ich nicht lösen kann.Webpack2 kann die Datei im Pfadnamen nicht auflösen
Ich erhalte diese Fehlermeldung:
Error: Can't resolve 'store/configureStore' in '/Users/samboy/company/oh-frontend/app'
Meine webpack Datei sieht wie folgt aus:
name: 'browser',
context: path.join(__dirname, '..', '..', '..', 'app'),
entry: {
app: './client'
},
output: {
// The output directory as absolute path
path: assetsPath,
// The filename of the entry chunk as relative path inside the output.path directory
filename: '[name].js',
// The output path from the view of the Javascript
publicPath: publicPath
},
module: {
loaders: commonLoaders
},
resolve: {
modules: [
path.resolve(__dirname, '..', '..', '..', 'app'),
'node_modules'
],
extensions: ['', '.js', '.jsx', '.css']
},
plugins: [
// extract inline css from modules into separate files
new ExtractTextPlugin('styles/bundled-modules.css'),
// files in global directory should be concatenated into one file for prod
new CopyWebpackPlugin([
{ from: 'fonts/', to: 'fonts/' }
, { from: '_web/css/global/fonts.css', to: 'styles/fonts.css' }
, { from: '_web/css/vendors', to: 'styles/vendors' }
]),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
}),
new webpack.DefinePlugin({
__DEVCLIENT__: false,
__DEVSERVER__: false,
__PLATFORM_WEB__: true,
__PLATFORM_IOS__: false
}),
new InlineEnviromentVariablesPlugin({ NODE_ENV: 'production' }),function()
{
this.plugin("done", function(stats)
{
if (stats.compilation.errors && stats.compilation.errors.length)
{
console.log(stats.compilation.errors);
process.exit(1);
}
// ...
});
}
],
postcss: postCSSConfig
}
Die Datei ist sicherlich in diesem Ordner. Es funktionierte gut mit Webpack. Es scheint jedoch nicht mit webpack2 zu funktionieren.
Ich denke, du hast Recht. Ich habe es hinzugefügt und Fehler an anderen Stellen bekommen. Wenn das gesagt ist, gibt es einen Weg, so dass ich './' nicht hinzufügen muss? Das wird mich dazu bringen, 1000er Dateien zu modifizieren. Es schien mit Webpack gut zu funktionieren, aber nur ein Problem mit webpack2 – ahskaus
./Bedeutet, es ist ein relativer Pfad und kein Alias. Stellen Sie sich zum Beispiel die Verwirrung zwischen "jquery" und "./jquery" vor. Am besten wäre es, ein Dienstprogramm zum Suchen und Ersetzen in Ihrer IDE zu verwenden – eavidan