zjk
2 天以前 95db3ac1352e1f98ba934da9e86fca00e661abe9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const path = require("path");
function resolve(dir) {
  return path.join(__dirname, dir);
}
module.exports = {
  outputDir: "laboratory", // 配置打包后的文件夹名称
  lintOnSave: false,
  publicPath: "/",
  devServer: {
    disableHostCheck: true, //禁用主机检查
    proxy: {
      "/": {
        // 设置以什么前缀开头的请求用来代理
        target: "http://192.168.110.34:11223", //要访问的跨域的域名
        secure: false, // 使用的是http协议则设置为false,https协议则设置为true
        changeOrigin: true, //开启代理
        pathRewrite: {
          "^/": "/",
        },
      },
      // "/": { // 设置以什么前缀开头的请求用来代理
      //     target: "http://221.182.45.100:11221", //要访问的跨域的域名
      //     secure: false, // 使用的是http协议则设置为false,https协议则设置为true
      //     changeOrigin: true, //开启代理
      //     pathRewrite: {
      //         "^/": "/",
      //     },
      // },
    },
  },
  configureWebpack: {
    resolve: {
      alias: {
        "@": resolve("src"),
      },
    },
    module: {
      rules: [
        {
          test: /\.m?js$/,
          include: /node_modules/,
          type: "javascript/auto",
          use: {
            loader: "babel-loader",
            options: {
              presets: ["@babel/preset-env"],
              plugins: ["@babel/plugin-proposal-nullish-coalescing-operator"],
            },
          },
        },
      ],
    },
  },
};