vue配置https

const path = require('path');
const fs = require('fs');
const https = require('https');
const options = {
  key: fs.readFileSync(path.join(__dirname, './ca/client.key')),
  cert: fs.readFileSync(path.join(__dirname, './ca/client.crt')),
  ca: fs.readFileSync(path.join(__dirname, './ca/ca_cert.pem')),
  checkServerIdentity: () => { return null; },
  requestCert: true,
};
console.log(options)


module.exports = {
  chainWebpack: (config) => {
    config.module
      .rule('svg')
      .exclude.add(path.resolve(__dirname, './src/assets/svgIcon'))
      .end();

    config.module
      .rule('icons')
      .test(/\.svg$/)
      .include.add(path.resolve(__dirname, './src/assets/svgIcon'))
      .end()
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
      .end();
  },
  css: {
    loaderOptions: {
      sass: {
        prependData: `
        @import "@computing/opendesign1/themes/plugins/variable.scss";
        @import "@/styles/variable.scss";
        `,
      },
    },
  },
  devServer: {
    port: 8081,
    proxy: {
      '/': {
        target: 'https://51.38.66.37:30035',
        ws: true,
        changeOrigin: true,
        agent: new https.Agent(options),
        logLevel: 'debug',
        pathRewrite: {
          '^/': '/',
        },
      },
    },
  },
};

  

posted @ 2023-07-13 22:19  易先讯  阅读(260)  评论(0编辑  收藏  举报