vue 打包後找不到路徑
阿新 • • 發佈:2019-01-07
在打包後發現點開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