ysy %!s(int64=2) %!d(string=hai) anos
pai
achega
781d4652a4
Modificáronse 3 ficheiros con 103 adicións e 2 borrados
  1. 1 1
      .gitignore
  2. 1 1
      src/public-path.js
  3. 101 0
      vue.config.js

+ 1 - 1
.gitignore

@@ -21,5 +21,5 @@ yarn-error.log*
 *.njsproj
 *.sln
 *.sw?
-vue.config.js
+
 package-lock.json

+ 1 - 1
src/public-path.js

@@ -2,7 +2,7 @@
   if (window.__POWERED_BY_QIANKUN__) {
     if (process.env.NODE_ENV === 'development') {
       // eslint-disable-next-line
-      __webpack_public_path__ = `//localhost:8080/aps/`;
+      __webpack_public_path__ = `//localhost:8080/qms/`;
       console.log('__webpack_public_path__', __webpack_public_path__);
       return;
     }

+ 101 - 0
vue.config.js

@@ -0,0 +1,101 @@
+const CompressionWebpackPlugin = require('compression-webpack-plugin');
+const { transformElementScss } = require('ele-admin/lib/utils/dynamic-theme');
+const path = require('path');
+const { name } = require('./package.json');
+
+function resolve(dir) {
+  return path.join(__dirname, dir);
+}
+
+module.exports = {
+  publicPath: '/qms',
+  lintOnSave: false,
+  productionSourceMap: false,
+  configureWebpack: {
+    performance: {
+      maxAssetSize: 2000000,
+      maxEntrypointSize: 2000000
+    },
+    output: {
+      // 把子应用打包成 umd 库格式
+      library: {
+        type: 'umd',
+        name: `${name}`
+      },
+
+      chunkLoadingGlobal: `webpackJsonp_${name}`
+    }
+  },
+  devServer: {
+    // 代理跨域的配置
+    proxy: {
+      // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
+      '/api': {
+        // target: 'http://192.168.3.51:18086', // 测试环境
+        target: 'http://124.71.68.31:50001',
+
+        changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
+        pathRewrite: {
+          '^/api': ''
+        }
+      }
+    },
+    headers: {
+      'Access-Control-Allow-Origin': '*'
+    }
+  },
+  chainWebpack(config) {
+    config.plugins.delete('prefetch');
+    // set svg-sprite-loader
+    // 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();
+    config.module
+      .rule('file-loader')
+      .test(/\.(pdf|docx|doc|xlsx|xls|mp4)$/)
+      .use('file-loader?name=[path][name].[ext]')
+      .loader('file-loader')
+      .end();
+    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();
+
+    if (process.env.NODE_ENV !== 'development') {
+      // gzip 压缩
+      config.plugin('compressionPlugin').use(
+        new CompressionWebpackPlugin({
+          test: /\.(js|css|html)$/,
+          threshold: 10240
+        })
+      );
+    }
+  },
+  css: {
+    loaderOptions: {
+      sass: {
+        sassOptions: {
+          outputStyle: 'expanded',
+          importer: transformElementScss()
+        }
+      }
+    }
+  }
+};