123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- const fs = require('fs')
- const { env } = require('process')
- const path = require('path')
- const { CleanWebpackPlugin } = require('clean-webpack-plugin')
- const { defineConfig } = require('@vue/cli-service')
- const Timestamp = new Date().getTime();
- function resolve(dir) {
- return path.join(__dirname, './', dir)
- }
- const baseFolder = env.APPDATA !== undefined && env.APPDATA !== '' ? `${env.APPDATA}/ASP.NET/https` : `${env.HOME}/.aspnet/https`;
- const certificateName = 'ies.examserver.client';
- const certFilePath = path.join(baseFolder, `${certificateName}.pem`);
- const keyFilePath = path.join(baseFolder, `${certificateName}.key`);
- if (!fs.existsSync(baseFolder)) {
- fs.mkdirSync(baseFolder, { recursive: true });
- }
- if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) {
- if (0 !== require('child_process').spawnSync(
- 'dotnet',
- [
- 'dev-certs',
- 'https',
- '--export-path',
- certFilePath,
- '--format',
- 'Pem',
- '--no-password',
- ],
- { stdio: 'inherit' }
- ).status
- ) {
- throw new Error('Could not create certificate.');
- }
- }
- //const target = process.env.VUE_APP_API_BASE_URL || 'https://localhost:6001';
- module.exports = defineConfig({
- transpileDependencies: true,
- lintOnSave: false,
- devServer: {
- https: {
- key: fs.readFileSync(keyFilePath),
- cert: fs.readFileSync(certFilePath),
- },
- port: 8082,
- proxy: {
- /* '^/(.*)': {
- target,
- secure: false,
- changeOrigin: false,
- }, */
- '/api': {
- target: 'https://localhost:6001', //后端接口
- secure: false,
- changeOrigin: false,
- pathRewrite: {
- '^/api': ''
- }
- },
- '/package': {
- target: 'https://localhost:6001', //后端接口
- secure: false,
- changeOrigin: false,
- pathRewrite: {
- '^/package': '/package'
- }
- },
- '/script': {
- target: 'https://localhost:6001', //后端接口
- secure: false,
- changeOrigin: false,
- pathRewrite: {
- '^/script': '/script'
- }
- },
- },
- historyApiFallback: true,
- },
- })
|