vue.config.js配置


// const path = require('path')

module.exports = {
    runtimeCompiler: true,
    devServer: {
        proxy: {
            '/mock': {
                target: 'https://easy-mock.com/mock/example',
                // ws: true,
                changeOrigin: true,
                pathRewrite: {//重寫路徑
                    "^/mock": ''
                }
            },
            '/api': {
              target: 'http://~',//測試
              // ws: true,
              changeOrigin: true,
              pathRewrite: {//重寫路徑
                  "^/api": ''
              }
            }
        }
    },
    pluginOptions: {
      'style-resources-loader': {
        patterns: [
          // main.js里全局引入css配置
          // path.resolve(__dirname, './src/styles/*.scss')
        ],
        preProcessor: 'scss'
      }
    },
    css: {
      // 向所有 Sass 樣式傳入共享的全局變量:
      loaderOptions: {
        // 給 sass-loader 傳遞選項
        sass: {
          // @/ 是 src/ 的別名
          // 所以這里假設你有 `src/variables.scss` 這個文件
          data: `@import "~@/styles/variables.scss";`
        }
      }
    }
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM