@aklinker1/aframe 0.4.6 → 0.4.7
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.
- package/package.json +1 -1
- package/src/config.ts +15 -7
- package/src/env.d.ts +6 -1
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -5,6 +5,11 @@ import type { LaunchOptions } from "puppeteer";
|
|
|
5
5
|
|
|
6
6
|
export type UserConfig = {
|
|
7
7
|
vite?: vite.UserConfigExport;
|
|
8
|
+
/**
|
|
9
|
+
* Paths for vite to proxy to the backend during development.
|
|
10
|
+
* @default ["/api"]
|
|
11
|
+
*/
|
|
12
|
+
proxyPaths?: string[];
|
|
8
13
|
prerenderedRoutes?: string[];
|
|
9
14
|
prerenderer?: PrerendererConfig | false;
|
|
10
15
|
};
|
|
@@ -78,8 +83,8 @@ export async function resolveConfig(
|
|
|
78
83
|
if (typeof viteConfig === "function") {
|
|
79
84
|
viteConfig = await viteConfig({ command, mode });
|
|
80
85
|
}
|
|
81
|
-
// Apply opinionated config that can be overwritten
|
|
82
86
|
|
|
87
|
+
// Apply opinionated config that can be overwritten
|
|
83
88
|
viteConfig = vite.mergeConfig<vite.InlineConfig, vite.InlineConfig>(
|
|
84
89
|
// Defaults
|
|
85
90
|
{
|
|
@@ -93,6 +98,14 @@ export async function resolveConfig(
|
|
|
93
98
|
);
|
|
94
99
|
|
|
95
100
|
// Override required config
|
|
101
|
+
const proxyPaths = userConfig.proxyPaths ?? ["/api"];
|
|
102
|
+
const proxy: Record<string, string | vite.ProxyOptions> = {};
|
|
103
|
+
proxyPaths.forEach((path) => {
|
|
104
|
+
proxy[path] = {
|
|
105
|
+
target: `http://localhost:${serverPort}`,
|
|
106
|
+
changeOrigin: true,
|
|
107
|
+
};
|
|
108
|
+
});
|
|
96
109
|
viteConfig = vite.mergeConfig<vite.InlineConfig, vite.InlineConfig>(
|
|
97
110
|
// Defaults
|
|
98
111
|
viteConfig,
|
|
@@ -109,12 +122,7 @@ export async function resolveConfig(
|
|
|
109
122
|
server: {
|
|
110
123
|
port: appPort,
|
|
111
124
|
strictPort: true,
|
|
112
|
-
proxy
|
|
113
|
-
"/api": {
|
|
114
|
-
target: `http://localhost:${serverPort}`,
|
|
115
|
-
changeOrigin: true,
|
|
116
|
-
},
|
|
117
|
-
},
|
|
125
|
+
proxy,
|
|
118
126
|
},
|
|
119
127
|
},
|
|
120
128
|
);
|
package/src/env.d.ts
CHANGED
|
@@ -2,7 +2,12 @@ import "vite/client";
|
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
interface ImportMeta {
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Absolute path or relative path (relative to main server file, not CWD).
|
|
7
|
+
* This ensures the public directory path is constant regardless of the CWD.
|
|
8
|
+
* It allows dev mode, production builds, and preview mode to all run from
|
|
9
|
+
* any working directory.
|
|
10
|
+
*/
|
|
6
11
|
publicDir: string;
|
|
7
12
|
command: string;
|
|
8
13
|
}
|