From c18e87068e09c521e2c28c4ae4cca2f0b6dfe393 Mon Sep 17 00:00:00 2001 From: "https://blog.iamtsm.cn" <1905333456@qq.com> Date: Fri, 7 Jul 2023 19:26:31 +0800 Subject: [PATCH] fix: vite --- svr/conf/cfg.json | 4 ++-- svr/vite.config.js | 26 ++++++++++++++------------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/svr/conf/cfg.json b/svr/conf/cfg.json index 4606336..0067843 100644 --- a/svr/conf/cfg.json +++ b/svr/conf/cfg.json @@ -1,12 +1,12 @@ { - "version": "10.2.3", + "version": "10.2.5", "ws": { "port": 8444, "host": "ws://127.0.0.1:8444" }, "wss": { "port": 8444, - "host": "wss://域名 || wss://ip:8444" + "host": "wss://域名 或者 wss://ip:8444" }, "api": { "port": 9092, diff --git a/svr/vite.config.js b/svr/vite.config.js index c8d469f..8f75646 100644 --- a/svr/vite.config.js +++ b/svr/vite.config.js @@ -1,16 +1,18 @@ -const path = require("path"); -const glob = require("glob"); -const { fileURLToPath } = require("url"); -const copy = require("rollup-plugin-copy"); +import path from "path"; +import * as glob from "glob"; +import { fileURLToPath } from 'url'; +import copy from "rollup-plugin-copy"; const url = import.meta.url; -module.exports = { +export default { plugins: [ copy({ targets: [ - { src: 'res/*.html', dest: 'res/dist' }, - { src: 'res/image/*', dest: 'res/dist/image' } - ] + { src: 'res/*.html', dest: 'res/dist' }, + { src: 'res/image/*', dest: 'res/dist/image' } + ], + hook: 'writeBundle', + verbose: true }) ], build: { @@ -25,7 +27,7 @@ module.exports = { ]) ), output: { - dir : "./res/dist/", + dir: "./res/dist/", entryFileNames: "[name].min.js", assetFileNames: "css/[name].min[extname]" }, @@ -33,9 +35,9 @@ module.exports = { minify: "terser", terserOptions: { compress: true, - mangle:true, - toplevel:false, - keep_classnames:false + mangle: true, + toplevel: false, + keep_classnames: false }, reportCompressedSize: false, sourcemap: false,