Answer the question
In order to leave comments, you need to log in
Why is my webpack incorrectly pointing to compiled files?
I'm getting an error
build.js:1 GET http://127.0.0.1:8081/dist2.build.js net::ERR_ABORTED 404 (Not Found)
build.js:12 [Vue warn]: Failed to resolve async component: ()=>n.e(2).then(n.bind(null,339))
Reason: Error: Loading chunk 2 failed.
const path = require('path');
const { VueLoaderPlugin } = require('vue-loader');
const config = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, "dist"),
publicPath: "dist",
filename: "build.js"
},
module: {
rules: [
{
test: /\.vue$/,
use: 'vue-loader'
},
{
test: /\.css$/,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" }
]
},
{
test: /\.scss$/,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" },
{ loader: "sass-loader" }
]
},
{
test: /\.svg$/,
loader: 'vue-svg-loader',
}
]
},
resolve: {
alias: {
vue: 'vue/dist/vue.js',
'@': path.join(__dirname, 'src/'),
}
},
plugins: [
new VueLoaderPlugin()
],
};
module.exports = (env, argv) => {
if (argv.mode !== "production") {
config.mode = "development";
config.devtool = 'source-map';
config.watch = true;
config.devServer = { contentBase: __dirname + '/' }
}
return config;
};
Answer the question
In order to leave comments, you need to log in
I found my cant why these files were accessed this way. It was necessary to put publicPath not "dist" but "dist/"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question