[Solved] Vue cli 3.0 error: “Failed to load resource: net::ERR_FILE_NOT_FOUND”

Cli3.0 solution:

Failed to load resource: net::ERR_ FILE_ NOT_ FOUND

Open dist/index.html. There is a problem with the introduction

The configuration file of webpack cannot be found in the project created by Vue cli 3.0, because Vue cli 3.0 encapsulates it. You only need to modify it in the vue.config.js file in the root directory of the project (if the project does not have this file, add one directly in the root directory), and set the value of baseurl to “.”/”, as follows

const webpack = require("webpack");
module.exports = {
    pluginOptions: new webpack.ProvidePlugin({
        jQuery: "jquery",
        $: "jquery"
    }),
    baseUrl: './' // Just add this line
};

Cli2. X solution:

Open the config/index. JS file and add build – > Assets public path is changed to “.”/”, that is, a dot is added in front of it

1 build: {
2   // Template for index.html
3   index: path.resolve(__dirname, '../dist/index.html'),
4  
5   // Paths
6   assetsRoot: path.resolve(__dirname, '../dist'),
7   assetsSubDirectory: 'static',
8   assetsPublicPath: './',  // Modify the code here
9 }

OK, 2. X 3.0 can be solved

Please indicate the source of the reprint

Similar Posts: