zoukankan      html  css  js  c++  java
  • vue的config配置问题 以及 Refused to load the image 'http://localhost:8080/favicon.ico'

    在文件夹config的index.js中配置dev和build

    打包问题

      dev: {
        // Various Dev Server settings
        host: '127.0.0.1', // can be overwritten by process.env.HOST
        port: 80, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
        // Paths
        assetsSubDirectory: 'static',
        // 相对 绝对路径问题
        assetsPublicPath: '/',
        // proxyTable: {},
        proxyTable: {
          '/api': {
            // 测试
            target: 'http://47.105.107.186:8889',
            // 最新的开发环境
            // target: 'http://192.168.1.156:8889',
            // target: 'http://47.104.71.52:8889',
            // secure: false,  // 如果是https接口,需要配置这个参数
            changeOrigin: true,
            pathRewrite: {
              '^/api': '', //地址重写,省略api 看的格式正确
            }
          },
        },
        autoOpenBrowser: false,
        errorOverlay: true,
        notifyOnErrors: true,
        poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
    
        /**
         * Source Maps
         */
    
        // https://webpack.js.org/configuration/devtool/#development
        devtool: 'cheap-module-eval-source-map',
    
        // If you have problems debugging vue-files in devtools,
        // set this to false - it *may* help
        // https://vue-loader.vuejs.org/en/options.html#cachebusting
        cacheBusting: true,
    
        cssSourceMap: true
      },
    
      build: {
        index: path.resolve(__dirname, '../dist/index.html'),
        assetsSubDirectory: 'static',
        assetsPublicPath: './', //这行是改变的
    }
    
  • 相关阅读:
    构建之法阅读笔记05
    构建之法阅读笔记04
    构建之法阅读笔记03
    构建之法阅读笔记02
    构建之法阅读笔记01
    管理系统的简单解析---web
    Java中的异常处理
    多态
    重写与重载
    抽象类与接口
  • 原文地址:https://www.cnblogs.com/caoxueyang/p/13041807.html
Copyright © 2011-2022 走看看