chore: fixes for vite dev server (#2678)
parent
a404fb043d
commit
aa00c1c89c
|
@ -0,0 +1,2 @@
|
||||||
|
# Ignore artifacts:
|
||||||
|
dist
|
|
@ -47,7 +47,8 @@
|
||||||
"prettier": "^3.0.1",
|
"prettier": "^3.0.1",
|
||||||
"terser": "^5.19.2",
|
"terser": "^5.19.2",
|
||||||
"vite": "^4.4.9",
|
"vite": "^4.4.9",
|
||||||
"vite-plugin-compression2": "^0.10.3"
|
"vite-plugin-compression2": "^0.10.3",
|
||||||
|
"vite-plugin-rewrite-all": "^1.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aashutoshrathi/word-wrap": {
|
"node_modules/@aashutoshrathi/word-wrap": {
|
||||||
|
@ -2865,6 +2866,15 @@
|
||||||
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
|
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/connect-history-api-fallback": {
|
||||||
|
"version": "1.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz",
|
||||||
|
"integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/convert-source-map": {
|
"node_modules/convert-source-map": {
|
||||||
"version": "1.9.0",
|
"version": "1.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz",
|
||||||
|
@ -5716,6 +5726,21 @@
|
||||||
"@rollup/pluginutils": "^5.0.2"
|
"@rollup/pluginutils": "^5.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/vite-plugin-rewrite-all": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/vite-plugin-rewrite-all/-/vite-plugin-rewrite-all-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-W0DAchC8ynuQH0lYLIu5/5+JGfYlUTRD8GGNtHFXRJX4FzzB9MajtqHBp26zq/ly9sDt5BqrfdT08rv3RbB0LQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"connect-history-api-fallback": "^1.6.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"vite": "^2.0.0 || ^3.0.0 || ^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/vue": {
|
"node_modules/vue": {
|
||||||
"version": "2.7.14",
|
"version": "2.7.14",
|
||||||
"resolved": "https://registry.npmjs.org/vue/-/vue-2.7.14.tgz",
|
"resolved": "https://registry.npmjs.org/vue/-/vue-2.7.14.tgz",
|
||||||
|
|
|
@ -53,7 +53,8 @@
|
||||||
"prettier": "^3.0.1",
|
"prettier": "^3.0.1",
|
||||||
"terser": "^5.19.2",
|
"terser": "^5.19.2",
|
||||||
"vite": "^4.4.9",
|
"vite": "^4.4.9",
|
||||||
"vite-plugin-compression2": "^0.10.3"
|
"vite-plugin-compression2": "^0.10.3",
|
||||||
|
"vite-plugin-rewrite-all": "^1.0.1"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"> 1%",
|
"> 1%",
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { defineConfig } from "vite";
|
||||||
import legacy from "@vitejs/plugin-legacy";
|
import legacy from "@vitejs/plugin-legacy";
|
||||||
import vue2 from "@vitejs/plugin-vue2";
|
import vue2 from "@vitejs/plugin-vue2";
|
||||||
import { compression } from "vite-plugin-compression2";
|
import { compression } from "vite-plugin-compression2";
|
||||||
|
import pluginRewriteAll from "vite-plugin-rewrite-all";
|
||||||
|
|
||||||
const plugins = [
|
const plugins = [
|
||||||
vue2(),
|
vue2(),
|
||||||
|
@ -12,6 +13,7 @@ const plugins = [
|
||||||
additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
|
additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
|
||||||
}),
|
}),
|
||||||
compression({ include: /\.js$/i, deleteOriginalAssets: true }),
|
compression({ include: /\.js$/i, deleteOriginalAssets: true }),
|
||||||
|
pluginRewriteAll(), // fixes 404 error with paths containing dot in dev server
|
||||||
];
|
];
|
||||||
|
|
||||||
const resolve = {
|
const resolve = {
|
||||||
|
@ -29,6 +31,10 @@ export default defineConfig(({ command }) => {
|
||||||
resolve,
|
resolve,
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
|
"/api/command": {
|
||||||
|
target: "ws://127.0.0.1:8080",
|
||||||
|
ws: true,
|
||||||
|
},
|
||||||
"/api": "http://127.0.0.1:8080",
|
"/api": "http://127.0.0.1:8080",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue