@nikoyo-spa/vite-config 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +25 -6
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -163,12 +163,12 @@ function defineConfig(userConfig = {}) {
163
163
  hmr: true,
164
164
  host: true,
165
165
  port,
166
- proxy: {
167
- "/svc": VITE_PROXY_HOST,
168
- "/token": VITE_PROXY_HOST,
169
- "/login": VITE_PROXY_HOST,
170
- "/pub": VITE_PROXY_HOST
171
- }
166
+ proxy: createProxy(VITE_PROXY_HOST, [
167
+ "/svc",
168
+ "/login",
169
+ "/token",
170
+ "/pub"
171
+ ])
172
172
  }
173
173
  },
174
174
  userConfig
@@ -203,5 +203,24 @@ function renderNode(node) {
203
203
  function renderAttrs(attrs) {
204
204
  return Object.entries(attrs).map(([k, v]) => `${k}="${v}"`).join(" ");
205
205
  }
206
+ function createProxy(target, paths) {
207
+ return Object.fromEntries(
208
+ paths.map((path2) => [
209
+ path2,
210
+ {
211
+ target,
212
+ changeOrigin: true,
213
+ secure: false,
214
+ configure: (proxy) => {
215
+ proxy.on("proxyReq", (proxyReq) => {
216
+ proxyReq.setHeader("Host", "192.168.1.36:8080");
217
+ proxyReq.setHeader("Origin", "http://192.168.1.36:8080");
218
+ proxyReq.setHeader("Referer", `http://192.168.1.36:8080${path2}`);
219
+ });
220
+ }
221
+ }
222
+ ])
223
+ );
224
+ }
206
225
 
207
226
  export { defineConfig };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nikoyo-spa/vite-config",
3
3
  "type": "module",
4
- "version": "1.2.0",
4
+ "version": "1.2.1",
5
5
  "description": "Spa Vite Config",
6
6
  "author": "qianyongdong <https://github.com/qianyongdong>",
7
7
  "license": "MIT",
@@ -53,12 +53,12 @@
53
53
  "vue": "^3.5.25",
54
54
  "vue-i18n": "^11.2.2",
55
55
  "vue-router": "^4.6.4",
56
- "@nikoyo-spa/components": "1.2.0",
56
+ "@nikoyo-spa/components": "1.2.0-patch.1",
57
+ "@nikoyo-spa/resolvers": "1.2.0",
57
58
  "@nikoyo-spa/icons": "1.2.0",
58
- "@nikoyo-spa/core": "1.2.0",
59
- "@nikoyo-spa/metadata": "1.2.0",
60
59
  "@nikoyo-spa/import-map-shared": "1.2.0",
61
- "@nikoyo-spa/resolvers": "1.2.0"
60
+ "@nikoyo-spa/metadata": "1.2.0",
61
+ "@nikoyo-spa/core": "1.2.0"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "pnpm unbuild",