700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > vue 打包后找不到路径

vue 打包后找不到路径

时间:2020-06-17 16:32:51

相关推荐

vue 打包后找不到路径

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

我们需要在config文件下的

把assetsPublicPath: "/",

变成:assetsPublicPath: "./",

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

把:productionSourceMap: ture,

变成:productionSourceMap: false,

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

build: {// Template for index.htmlindex: path.resolve(__dirname, "../dist/index.html"),// PathsassetsRoot: path.resolve(__dirname, "../dist"),assetsSubDirectory: "static",assetsPublicPath: "./",/*** Source Maps*/productionSourceMap: false,// /configuration/devtool/#productiondevtool: "#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-pluginproductionGzip: 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 offbundleAnalyzerReport: process.env.npm_config_report}

-->index.js

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。