diff --git a/build/plugins/index.ts b/build/plugins/index.ts index 2a23f8085..dff898288 100644 --- a/build/plugins/index.ts +++ b/build/plugins/index.ts @@ -1,8 +1,10 @@ import type { PluginOption } from 'vite'; -import vue from './vue'; +import vue from '@vitejs/plugin-vue'; +import vueJsx from '@vitejs/plugin-vue-jsx'; +import unocss from 'unocss/vite'; +import { VitePWA } from 'vite-plugin-pwa'; import html from './html'; import unplugin from './unplugin'; -import unocss from './unocss'; import mock from './mock'; import visualizer from './visualizer'; import compress from './compress'; @@ -12,7 +14,7 @@ import compress from './compress'; * @param viteEnv - 环境变量配置 */ export function setupVitePlugins(viteEnv: ImportMetaEnv): (PluginOption | PluginOption[])[] { - const plugins = [...vue, html(viteEnv), ...unplugin, unocss, mock]; + const plugins = [vue(), vueJsx(), VitePWA(), html(viteEnv), ...unplugin, unocss(), mock]; if (viteEnv.VITE_VISUALIZER === 'Y') { plugins.push(visualizer); diff --git a/build/plugins/unocss.ts b/build/plugins/unocss.ts deleted file mode 100644 index 8882afcd4..000000000 --- a/build/plugins/unocss.ts +++ /dev/null @@ -1,3 +0,0 @@ -import unocss from 'unocss/vite'; - -export default unocss(); diff --git a/build/plugins/vue.ts b/build/plugins/vue.ts deleted file mode 100644 index 5bdfe0222..000000000 --- a/build/plugins/vue.ts +++ /dev/null @@ -1,6 +0,0 @@ -import vue from '@vitejs/plugin-vue'; -import vueJsx from '@vitejs/plugin-vue-jsx'; - -const plugins = [vue(), vueJsx()]; - -export default plugins; diff --git a/package.json b/package.json index f28d558fc..c4b2ef3e8 100644 --- a/package.json +++ b/package.json @@ -113,6 +113,7 @@ "vite-plugin-compression": "^0.5.1", "vite-plugin-html": "^3.2.0", "vite-plugin-mock": "^2.9.6", + "vite-plugin-pwa": "^0.12.3", "vite-plugin-svg-icons": "^2.0.1", "vue-tsc": "^0.40.1" }, diff --git a/vite.config.ts b/vite.config.ts index 53129b105..42995f1c7 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -30,13 +30,9 @@ export default defineConfig(configEnv => { }, server: { host: '0.0.0.0', - port: 3200, open: true, proxy: createViteProxy(isOpenProxy, envConfig) }, - preview: { - port: 5050 - }, optimizeDeps: { include: [ '@antv/data-set',