vue 打包后找不到路径

版权声明:未经本人同意不得私自转载 https://blog.csdn.net/qq_40190624/article/details/85990986

在打包后发现点开dist方件;浏览器中一片空白;

我们需要在config文件下的

把 assetsPublicPath: "/",

变成: assetsPublicPath: "./",

这个可以让他变成相对路径 

把: productionSourceMap: ture,

变成: productionSourceMap: false,

因为这个东西在打包的时候会给你生成很多SourceMap的东西;占用的空间会很大;主要是用来帮助我们调试的;

 build: {
    // Template for index.html
    index: path.resolve(__dirname, "../dist/index.html"),

    // Paths
    assetsRoot: path.resolve(__dirname, "../dist"),
    assetsSubDirectory: "static",
    assetsPublicPath: "./",

    /**
     * Source Maps
     */

    productionSourceMap: false,
    // https://webpack.js.org/configuration/devtool/#production
    devtool: "#source-map",

    // Gzip off by default as many popular static hosts such as
    // Surge or Netlify already gzip all static assets for you.
    // Before setting to `true`, make sure to:
    // npm install --save-dev compression-webpack-plugin
    productionGzip: false,
    productionGzipExtensions: ["js", "css"],

    // Run the build command with an extra argument to
    // View the bundle analyzer report after build finishes:
    // `npm run build --report`
    // Set to `true` or `false` to always turn it on or off
    bundleAnalyzerReport: process.env.npm_config_report
  }

 -->index.js

猜你喜欢

转载自blog.csdn.net/qq_40190624/article/details/85990986