zoukankan      html  css  js  c++  java
  • vue项目打包部署生产环境

    打包部署生产环境之前需要修改配置文件:

    修改一:build > utils.js  (修改publicPath:"../../" , 这样写是处理打包后找不到静态文件的问题)

    // Extract CSS when that option is specified
        // (which is the case during production build)
        if (options.extract) {
          return ExtractTextPlugin.extract({
            use: loaders,
            fallback: 'vue-style-loader',
            publicPath: '../../'
          })
        } else {
          return ['vue-style-loader'].concat(loaders)
        }

    修改二:config > index.js (修改assetsPublicPath:'./' ,修改目的是为了解决js找不到的问题)

     // Template for index.html
        index: path.resolve(__dirname, '../dist/index.html'),
    
        // Paths
        assetsRoot: path.resolve(__dirname, '../dist'),
        assetsSubDirectory: 'static',
        assetsPublicPath: './',

     3.运行命令:npm run build 打包直接访问dist文件夹中的index.html即可。

  • 相关阅读:
    hdoj-1004-Let the Balloon Rise(水题)
    hdoj-1827-Summer Holiday(scc+缩点)
    poj--3624--Charm Bracelet(动态规划 水题)
    HDU
    HDU
    HDU
    HDU
    【POJ1654】Area【叉积】
    【POJ1654】Area【叉积】
    【SSLOJ1715】计算面积【叉积】
  • 原文地址:https://www.cnblogs.com/matd/p/12930338.html
Copyright © 2011-2022 走看看