vue2.0 打包后 页面 Failed to load resource: net::ERR_FILE_NOT_FOUND 或打开为空白

在这里插入图片描述
在这里插入图片描述
vue.config.js 代码 适用与vue-cli3 以上版本

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false, // 只需要在原有的语句的基础上加上这一句
  publicPath: "./",
  outputDir: "./dist",
  /* 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录 */
  assetsDir: "static",
  /* 是否在构建生产包时生成 sourceMap 文件,false将提高构建速度 */
  productionSourceMap: false,
  /* 默认情况下,生成的静态资源在它们的文件名中包含了 hash 以便更好的控制缓存,你可以通过将这个选项设为 false 来关闭文件名哈希。(false的时候就是让原来的文件名不改变) */


  
})

// vue.config.js
// const CopyWebpackPlugin = require("copy-webpack-plugin");
// const webpack = require("webpack");
 
 
// const path = require("path"); //引入path模块
// function resolve(dir) {
//   return path.join(__dirname, dir); //path.join(__dirname)设置绝对路径
// }
// module.exports = {
//   lintOnSave: false,
//   // publicPath: '/xayw_jc',
//   productionSourceMap: false, //关闭 SourceMap,webpack://
//   // publicPath:
//   //   process.env.NODE_ENV === "production" ? "/\n" + "vue-cesium-example/" : "/",
//   configureWebpack: {
//     resolve: {
//       alias: {
//         "@": resolve("src"),
//       },
//     },
//     plugins: [
//       // Copy Cesium Assets, Widgets, and Workers to a static directory
//       new CopyWebpackPlugin({
//         patterns: [{
//           from: "node_modules/cesium/Build/Cesium/Workers",
//           to: "Workers"
//         },
//         {
//           from: "node_modules/cesium/Build/Cesium/ThirdParty",
//           to: "ThirdParty",
//         },
//         {
//           from: "node_modules/cesium/Build/Cesium/Assets",
//           to: "Assets"
//         },
//         {
//           from: "node_modules/cesium/Build/Cesium/Widgets",
//           to: "Widgets"
//         },
//         ],
//       }),
//       new webpack.DefinePlugin({
//         // Define relative base path in cesium for loading assets
//         CESIUM_BASE_URL: JSON.stringify(""),
//       }),
 
//       // new BundleAnalyzerPlugin() //解开可查看项目打包分布情况
//     ],
//     module: {
//       // Removes these errors: "Critical dependency: require function is used in a way in which dependencies cannot be statically extracted"
//       // https://github.com/AnalyticalGraphicsInc/cesium-webpack-example/issues/6
//       unknownContextCritical: false,
//       unknownContextRegExp: /\/cesium\/cesium\/Source\/Core\/buildModuleUrl\.js/,
//       rules: [
//         {
//           test: /\.mjs$/,
//           include: /node_modules/,
//           type: "javascript/auto"
//         },
//       ]
//     },
//   },
//   chainWebpack: (config) => {
//     config.module.rule("svg").exclude.add(resolve("src/icons")).end();
//     config.module
//       .rule("icons")
//       .test(/\.svg$/)
//       .include.add(resolve("src/icons"))
//       .end()
//       .use("svg-sprite-loader")
//       .loader("svg-sprite-loader")
//       .options({
//         symbolId: "icon-[name]",
//       })
//       .end();
//   },
// };


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值