@gxp-dev/tools 2.0.48 → 2.0.50
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/runtime/vite.config.js +8 -16
- package/template/vite.config.js +3 -0
package/package.json
CHANGED
package/runtime/vite.config.js
CHANGED
|
@@ -95,22 +95,11 @@ function getHttpsConfig(env) {
|
|
|
95
95
|
* Find the gx-devtools package directory (works for both local and global installs)
|
|
96
96
|
*/
|
|
97
97
|
function findToolkitPath() {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
//
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
return localPath;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Try to find via require.resolve
|
|
107
|
-
try {
|
|
108
|
-
const pkgPath = require.resolve(`${packageName}/package.json`);
|
|
109
|
-
return path.dirname(pkgPath);
|
|
110
|
-
} catch (e) {
|
|
111
|
-
// Fallback: assume we're in the toolkit itself during development
|
|
112
|
-
return process.cwd();
|
|
113
|
-
}
|
|
98
|
+
// Derive from this config file's own location — always reliable regardless
|
|
99
|
+
// of how the package is installed (local, global, npm link, CI, etc.)
|
|
100
|
+
// This file lives at <toolkit>/runtime/vite.config.js, so toolkit root is one level up.
|
|
101
|
+
const configFileDir = path.dirname(fileURLToPath(import.meta.url));
|
|
102
|
+
return path.resolve(configFileDir, "..");
|
|
114
103
|
}
|
|
115
104
|
|
|
116
105
|
/**
|
|
@@ -314,6 +303,9 @@ export default defineConfig(({ mode }) => {
|
|
|
314
303
|
port: parseInt(env.NODE_PORT) || 3060,
|
|
315
304
|
strictPort: true,
|
|
316
305
|
https: getHttpsConfig(env),
|
|
306
|
+
allowedHosts: env.ALLOWED_HOSTS
|
|
307
|
+
? env.ALLOWED_HOSTS.split(",").map((h) => h.trim()).filter(Boolean)
|
|
308
|
+
: [],
|
|
317
309
|
cors: {
|
|
318
310
|
origin: "*",
|
|
319
311
|
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
|
package/template/vite.config.js
CHANGED
|
@@ -252,6 +252,9 @@ export default defineConfig(({ mode }) => {
|
|
|
252
252
|
port: parseInt(env.NODE_PORT) || 3060,
|
|
253
253
|
strictPort: true,
|
|
254
254
|
https: getHttpsConfig(env),
|
|
255
|
+
allowedHosts: env.ALLOWED_HOSTS
|
|
256
|
+
? env.ALLOWED_HOSTS.split(",").map((h) => h.trim()).filter(Boolean)
|
|
257
|
+
: [],
|
|
255
258
|
cors: {
|
|
256
259
|
origin: "*",
|
|
257
260
|
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
|