@gxp-dev/tools 2.0.93 → 2.0.94
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 +24 -11
package/package.json
CHANGED
package/runtime/vite.config.js
CHANGED
|
@@ -123,16 +123,28 @@ function hasLocalFile(fileName) {
|
|
|
123
123
|
/**
|
|
124
124
|
* Try to load the `@tailwindcss/vite` plugin from the project's node_modules.
|
|
125
125
|
*
|
|
126
|
-
* Tailwind 4
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
126
|
+
* Tailwind 4 is a DEV-ONLY base CSS framework here — declared in the project's
|
|
127
|
+
* devDependencies and imported via `@import "tailwindcss";` inside the
|
|
128
|
+
* theme-layouts. We deliberately do not run it during `vite build`:
|
|
129
|
+
*
|
|
130
|
+
* 1. The layouts aren't part of the production build (entry is
|
|
131
|
+
* `src/Plugin.vue`), so there's no `@import "tailwindcss"` reaching the
|
|
132
|
+
* build graph and the generated utilities would have nowhere to live.
|
|
133
|
+
* 2. The plugin scans the whole project (including `node_modules`) for
|
|
134
|
+
* candidate class names. `@gxp-dev/uikit` ships compiled Vue files
|
|
135
|
+
* containing arbitrary-value classes like
|
|
136
|
+
* `bg-[var(--keyboard_key_active_background_color,var(--primary))]`,
|
|
137
|
+
* which Tailwind 4 lowers to CSS with spaces in the var name — invalid
|
|
138
|
+
* CSS that breaks `lightningcss` minification at build time.
|
|
139
|
+
*
|
|
140
|
+
* In dev (`command === "serve"`) we load it; in build we skip and let the
|
|
141
|
+
* platform supply Tailwind at runtime (per `app-manifest.json.baseFramework`).
|
|
142
|
+
* Silently no-ops if the user has uninstalled Tailwind.
|
|
134
143
|
*/
|
|
135
|
-
async function loadTailwindPlugin() {
|
|
144
|
+
async function loadTailwindPlugin(command) {
|
|
145
|
+
if (command !== "serve") {
|
|
146
|
+
return null
|
|
147
|
+
}
|
|
136
148
|
try {
|
|
137
149
|
const mod = await import("@tailwindcss/vite")
|
|
138
150
|
const plugin = mod.default ?? mod
|
|
@@ -438,9 +450,10 @@ export default defineConfig(async (ctx) => {
|
|
|
438
450
|
const useHttps = getHttpsConfig(env) !== undefined
|
|
439
451
|
|
|
440
452
|
// Load Tailwind 4 Vite plugin from the project's node_modules if present.
|
|
441
|
-
|
|
453
|
+
// Dev-only — production builds skip it (see loadTailwindPlugin docs).
|
|
454
|
+
const tailwindPlugin = await loadTailwindPlugin(ctx.command)
|
|
442
455
|
if (tailwindPlugin) {
|
|
443
|
-
console.log("🎨 Tailwind: @tailwindcss/vite plugin loaded")
|
|
456
|
+
console.log("🎨 Tailwind: @tailwindcss/vite plugin loaded (dev)")
|
|
444
457
|
}
|
|
445
458
|
|
|
446
459
|
// Get API proxy target for non-mock environments
|