@gxp-dev/tools 2.0.78 → 2.0.79
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 +23 -13
package/package.json
CHANGED
package/runtime/vite.config.js
CHANGED
|
@@ -314,24 +314,34 @@ export default defineConfig(async (ctx) => {
|
|
|
314
314
|
// GxP Inspector plugin for browser extension integration
|
|
315
315
|
...(useInspector ? [gxpInspectorPlugin()] : []),
|
|
316
316
|
// `externalGlobals` rewrites `import ... from "vue"` → references to
|
|
317
|
-
// the `Vue` global that the GxP platform exposes on `window
|
|
318
|
-
//
|
|
319
|
-
// bootstraps its own Vue + Pinia (via main.js → createApp + app.use),
|
|
320
|
-
// and rewriting `from "pinia"` to a non-existent `window.Pinia`
|
|
321
|
-
// crashes `getActivePinia()` at store init.
|
|
317
|
+
// the `Vue` global that the GxP platform exposes on `window`, and
|
|
318
|
+
// `@/stores/gxpPortalConfigStore` imports → `window.useGxpStore`.
|
|
322
319
|
//
|
|
323
|
-
//
|
|
324
|
-
//
|
|
325
|
-
//
|
|
326
|
-
|
|
327
|
-
|
|
320
|
+
// We want this to run in BOTH dev and build so user source code keeps
|
|
321
|
+
// the same external-store indirection regardless of mode. The only
|
|
322
|
+
// exception is the toolkit's own runtime code (`@gxp-dev/tools/runtime/
|
|
323
|
+
// *.js` and the workspace equivalent) — that code bootstraps its own
|
|
324
|
+
// local Vue + Pinia via main.js (createApp + app.use) and would crash
|
|
325
|
+
// with "getActivePinia() was called" if its `from "pinia"` were
|
|
326
|
+
// rewritten to a non-existent `window.Pinia`.
|
|
327
|
+
//
|
|
328
|
+
// So: exclude the toolkit's runtime from the transform.
|
|
329
|
+
externalGlobals(
|
|
330
|
+
{
|
|
328
331
|
vue: "Vue",
|
|
329
332
|
pinia: "Pinia",
|
|
330
333
|
"@/stores/gxpPortalConfigStore":
|
|
331
334
|
"(window.useGxpStore || (() => { console.warn('useGxpStore not found on window, using fallback'); return {}; }))",
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
exclude: [
|
|
338
|
+
// Consumer install (published toolkit from npm)
|
|
339
|
+
"**/node_modules/@gxp-dev/tools/**",
|
|
340
|
+
// Workspace / `npm link` / self-dev: the runtime source itself
|
|
341
|
+
`${runtimeDir.replace(/\\/g, "/")}/**`,
|
|
342
|
+
],
|
|
343
|
+
},
|
|
344
|
+
),
|
|
335
345
|
// Custom request logging and CORS plugin
|
|
336
346
|
{
|
|
337
347
|
name: "request-logger-cors",
|