|
@@ -17,85 +17,65 @@ import VueSetupExtend from 'vite-plugin-vue-setup-extend'
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
export default defineConfig(({ mode }) => {
|
|
|
-
|
|
|
- const config = loadEnv(mode, './');
|
|
|
- console.log(config);
|
|
|
- return {
|
|
|
- base: "./",
|
|
|
- plugins: [
|
|
|
- vue(),
|
|
|
- removeConsole(),
|
|
|
- compression(),
|
|
|
- monacoEditorPlugin({}), // 启用 Monaco Editor 插件
|
|
|
- AutoImport({
|
|
|
- //安装两行后你会发现在组件中不用再导入ref,reactive等
|
|
|
- imports: ['vue', 'vue-router'],
|
|
|
- //存放的位置
|
|
|
- dts: "src/auto-import.d.ts",
|
|
|
- }),
|
|
|
- Components({
|
|
|
- // 引入组件的,包括自定义组件,存放的位置
|
|
|
- dts: "src/components.d.ts",
|
|
|
- }),
|
|
|
- VueSetupExtend(),
|
|
|
- ],
|
|
|
+ const config = loadEnv(mode, './');
|
|
|
+ if (mode === 'development') console.debug('Loaded env:', config);
|
|
|
|
|
|
- //1、 ↓解析配置
|
|
|
- resolve: {
|
|
|
- // ↓路径别名
|
|
|
- alias: {
|
|
|
- '@': resolve('src'),
|
|
|
- '@views': resolve('src/views')
|
|
|
- }
|
|
|
+ return {
|
|
|
+ base: "./",
|
|
|
+ plugins: [
|
|
|
+ vue(),
|
|
|
+ removeConsole(),
|
|
|
+ compression(),
|
|
|
+ monacoEditorPlugin({}),
|
|
|
+ AutoImport({
|
|
|
+ imports: ['vue', 'vue-router'],
|
|
|
+ dts: "src/auto-import.d.ts",
|
|
|
+ }),
|
|
|
+ Components({
|
|
|
+ dts: "src/components.d.ts",
|
|
|
+ }),
|
|
|
+ VueSetupExtend(),
|
|
|
+ ],
|
|
|
+ resolve: {
|
|
|
+ alias: {
|
|
|
+ '@': resolve('src'),
|
|
|
+ '@views': resolve('src/views')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ server: {
|
|
|
+ proxy: {
|
|
|
+ '/api': {
|
|
|
+ target: 'https://www.adicn.com/eps',
|
|
|
+ secure: false,
|
|
|
+ changeOrigin: true,
|
|
|
+ rewrite: (path) => path.replace(/^\/api/, '')
|
|
|
},
|
|
|
-
|
|
|
- //代理
|
|
|
- server: {
|
|
|
- proxy: {
|
|
|
- '/api': {
|
|
|
- // target: 'http://192.168.0.131:8188/TransServlet',//配置文件获取地址
|
|
|
- target: 'https://www.adicn.com/eps',
|
|
|
- secure: false, //接受使用https
|
|
|
- changeOrigin: true, //允许跨域
|
|
|
- ws: false, //使用websocket
|
|
|
- rewrite: (path) => path.replace(/^\/api/, '')
|
|
|
- },
|
|
|
- '/eps': {
|
|
|
- // target: 'http://192.168.0.131:8188/TransServlet',//配置文件获取地址
|
|
|
- target: 'https://www.adicn.com/eps',
|
|
|
- secure: false, //接受使用https
|
|
|
- changeOrigin: true, //允许跨域
|
|
|
- ws: false, //使用websocket
|
|
|
- rewrite: (path) => path.replace(/^\/eps/, '')
|
|
|
- },
|
|
|
-
|
|
|
- '/file': {
|
|
|
- // target: 'http://192.168.0.15:8081/', // 后端接口地址
|
|
|
- target: 'http://192.168.0.43:2201/',
|
|
|
- secure: false, //接受使用https
|
|
|
- changeOrigin: true, //允许跨域
|
|
|
- ws: false, //使用websocket
|
|
|
- pathRewrite: { // 路径重写
|
|
|
- '^/file': ''
|
|
|
- }
|
|
|
- }, '/websokct': {
|
|
|
- target: 'http://192.168.0.104:8188',
|
|
|
- // target: 'http://192.168.0.43:8081/',
|
|
|
- // target: 'https://www.gzchain.org.cn/managersvc/', //后端接口地址
|
|
|
- secure: false, //接受使用https
|
|
|
- },
|
|
|
-
|
|
|
- }
|
|
|
+ '/eps': {
|
|
|
+ target: 'https://www.adicn.com/eps',
|
|
|
+ secure: false,
|
|
|
+ changeOrigin: true,
|
|
|
+ rewrite: (path) => path.replace(/^\/eps/, '')
|
|
|
},
|
|
|
- renderer: {
|
|
|
- css: {
|
|
|
- preprocessorOptions: {
|
|
|
- scss: {
|
|
|
- silenceDeprecations: ['legacy-js-api']
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ '/file': {
|
|
|
+ target: 'http://192.168.0.43:2201/',
|
|
|
+ secure: false,
|
|
|
+ changeOrigin: true,
|
|
|
+ rewrite: path => path.replace(/^\/file/, '')
|
|
|
+ },
|
|
|
+ '/websocket': { // 原为 websockt,修正拼写
|
|
|
+ target: 'http://192.168.0.104:8188',
|
|
|
+ secure: false,
|
|
|
+ changeOrigin: true
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ css: {
|
|
|
+ preprocessorOptions: {
|
|
|
+ scss: {
|
|
|
+ // optional: global SCSS variables/mixins
|
|
|
+ // additionalData: `@import "@/styles/variables.scss";`
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
-})
|
|
|
+ };
|
|
|
+});
|