From 3e30913bd480b2d1097691e6b12e6fcfa7b0f046 Mon Sep 17 00:00:00 2001 From: Anthony Rey Date: Fri, 7 Oct 2022 10:26:27 +0200 Subject: [PATCH] Launch both vite and tikui in dev mode --- package.json | 7 ++++--- tikuiconfig.json | 1 + vite.config.ts | 10 ++++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index e5651cecd55..8c0ff82e316 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "license": "Apache-2.0", "scripts": { "build": "vue-tsc -p tsconfig.build.json --noEmit && vite build --emptyOutDir && tikui-core build", - "dev": "vite", + "dev": "npm run tikui:serve & npm run webapp:serve", "e2e": "cypress open --config-file src/test/javascript/cypress/cypress-config.ts", "e2e:headless": "cypress run --headless --config-file src/test/javascript/cypress/cypress-config.ts", "format": "prettier . --write", @@ -36,11 +36,12 @@ "prettier:format": "npm run prettier:run -- --write", "prettier:run": "prettier \"{{src/**/,}*.{md,json,yml,html,vue,java,xml},*.{js,ts},src/{main/glyph,main/webapp,test/javascript}/**/*.{css,scss}}\"", "preview": "vite preview", - "start": "vite", + "start": "npm run dev", "test": "npm run jest --", "test:clear": "jest --clearCache", "test:watch": "npm run jest -- --watch", - "tikui:serve": "tikui-core serve" + "tikui:serve": "tikui-core serve", + "webapp:serve": "vite" }, "dependencies": { "axios": "0.27.2", diff --git a/tikuiconfig.json b/tikuiconfig.json index d6eeaa16946..c3a9fc93699 100644 --- a/tikuiconfig.json +++ b/tikuiconfig.json @@ -2,6 +2,7 @@ "documentation": "tikui", "src": "src/main/style", "dist": "target/classes/public/style", + "port": 9005, "expose": { "src/main/glyph": "glyph" } diff --git a/vite.config.ts b/vite.config.ts index 245cf9b1346..0f5308cd620 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from 'vite'; import vue from '@vitejs/plugin-vue'; -import path from 'path'; +import * as path from 'path'; // https://vitejs.dev/config/ export default defineConfig({ @@ -33,7 +33,13 @@ export default defineConfig({ '/style': { ws: true, changeOrigin: true, - target: 'http://localhost:7471', + rewrite: path => path.replace(/^\/style/, ''), + target: 'http://localhost:9005', + }, + '/reload': { + ws: true, + changeOrigin: true, + target: 'http://localhost:9005', }, }, },