123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- import {defineConfig} from "vite";
- import path from 'path';
- import vue from '@vitejs/plugin-vue'
- import AutoImport from 'unplugin-auto-import/vite';
- import { createHtmlPlugin } from 'vite-plugin-html';
- export default defineConfig({
- publicDir: path.resolve(__dirname + '/node_modules/icore-frame', './public'), // 将my-vue-app目录下的public文件复制到dist目录下
- // 开发服务器配置
- server: {
- // 服务器主机名,如果允许外部访问,可设置为 '0.0.0.0'
- host: '0.0.0.0',
- // 开发环境服务器端口号
- port: 3000,
- proxy: {
- '/xgjl/pass/auth': {
- //target: 'http://sso.steerinfo.com/auth',
- //target: 'http://sso.steerinfo.com/auth',
- target:'http://192.168.3.33/xgjl/pass/auth',
- changeOrigin: true,
- /**
- pathRewrite: {
- '^/icore.icp.web/pass/auth': '/'
- } */
- rewrite: (path) => path.replace(/^\/xgjl\/pass\/auth/, '/')
- },
- '/xgjl/pass/v1': {
- //target: 'http://sso.steerinfo.com/v1',
- target:'http://192.168.3.33/xgjl/pass/v1',
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/xgjl\/pass\/v1/, '/')
- },
- '/xgjl/pass/logout': {
- //target: 'http://sso.steerinfo.com/logout',
- target:'http://192.168.3.33/xgjl/pass/logout',
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/xgjl\/pass\/logout/, '/')
- },
- '/xgjl/pass/systemBase/v1': {
- target: 'http://192.168.3.33/xgjl/pass/systemBase/v1',
- //target: 'http://localhost:9004/v1',
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/xgjl\/pass\/systemBase\/v1/, '/')
- },
- /**
- '/views/' : {
- target: 'http://localhost:3000/node_modules/my-vue-app/views/',
- changeOrigin: true,
- rewrite: (path) => path.replace(/^\/views/, '/')
- } */
- /**
- '/views/': {
- target: 'http://127.0.0.1:3000', // 目标地址,这里设置为本地地址,因为是重定向到本地的不同路径
- changeOrigin: true,
- rewrite: (path) => {
- const pattern = /^\/views\/(?!(index|systemConfig)\.html$).*\.html$/;
- //const pattern = /^\/views\/(?!(index|systemConfig)\b).*$/;
- if (pattern.test(path)) {
- // 自己项目下的页面,统统走这里
- return path.replace('/views/', '/pages/');
- }
-
- // index,systemConfig模块走这里
- return path.replace('/views/', '/node_modules/icore-frame/pages/');
- }
- } */
- '/views/index.html': {
- target: 'http://127.0.0.1:3000',
- rewrite: (path) => path.replace('/views/index.html', '/node_modules/icore-frame/pages/index.html'),
- changeOrigin: true
- },
- '/views/systemConfig.html': {
- target: 'http://127.0.0.1:3000',
- rewrite: (path) => path.replace('/views/systemConfig.html', '/node_modules/icore-frame/pages/systemConfig.html'),
- changeOrigin: true
- }
- }
- },
- build:{
- rollupOptions:{
- input: {
- //'index' : '/views/index.html',
- //'systemConfig' : '/views/systemConfig.html',
- //'systemBase' : '/views/systemBase.html',
- // 'index' : '/node_modules/my-vue-app/views/index.html'
- //'index' : path.resolve(__dirname, '../../views/indexxx.html')
- }
- }
- },
- plugins: [
- vue(),
-
- AutoImport({
- imports: ['vue','vuex','vue-router'],
- dts: 'src/auto-imports.d.ts'
- }),
- ]
- });
|