@gxp-dev/tools 2.0.39 → 2.0.40
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 +15 -9
- package/template/vite.config.js +13 -5
package/package.json
CHANGED
package/runtime/vite.config.js
CHANGED
|
@@ -211,18 +211,24 @@ export default defineConfig(({ mode }) => {
|
|
|
211
211
|
const layoutsDir = path.resolve(process.cwd(), "theme-layouts");
|
|
212
212
|
const layoutFallbackPlugin = {
|
|
213
213
|
name: "gxp-layout-fallback",
|
|
214
|
+
enforce: "pre",
|
|
214
215
|
resolveId(source) {
|
|
215
|
-
//
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
// Handle @layouts/ alias imports
|
|
217
|
+
if (source.startsWith("@layouts/")) {
|
|
218
|
+
const fileName = source.replace("@layouts/", "");
|
|
219
|
+
const localFile = path.resolve(layoutsDir, fileName);
|
|
220
|
+
if (fs.existsSync(localFile)) return null;
|
|
221
|
+
return `\0gxp-layout-fallback:${fileName}`;
|
|
222
|
+
}
|
|
220
223
|
|
|
221
|
-
//
|
|
222
|
-
if (
|
|
224
|
+
// Handle already-resolved absolute paths to theme-layouts/
|
|
225
|
+
if (source.startsWith(layoutsDir + "/")) {
|
|
226
|
+
if (fs.existsSync(source)) return null;
|
|
227
|
+
const fileName = source.replace(layoutsDir + "/", "");
|
|
228
|
+
return `\0gxp-layout-fallback:${fileName}`;
|
|
229
|
+
}
|
|
223
230
|
|
|
224
|
-
|
|
225
|
-
return `\0gxp-layout-fallback:${fileName}`;
|
|
231
|
+
return null;
|
|
226
232
|
},
|
|
227
233
|
load(id) {
|
|
228
234
|
if (!id.startsWith("\0gxp-layout-fallback:")) return null;
|
package/template/vite.config.js
CHANGED
|
@@ -150,12 +150,20 @@ export default defineConfig(({ mode }) => {
|
|
|
150
150
|
const layoutsDir = path.resolve(process.cwd(), "theme-layouts");
|
|
151
151
|
const layoutFallbackPlugin = {
|
|
152
152
|
name: "gxp-layout-fallback",
|
|
153
|
+
enforce: "pre",
|
|
153
154
|
resolveId(source) {
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
if (source.startsWith("@layouts/")) {
|
|
156
|
+
const fileName = source.replace("@layouts/", "");
|
|
157
|
+
const localFile = path.resolve(layoutsDir, fileName);
|
|
158
|
+
if (fs.existsSync(localFile)) return null;
|
|
159
|
+
return `\0gxp-layout-fallback:${fileName}`;
|
|
160
|
+
}
|
|
161
|
+
if (source.startsWith(layoutsDir + "/")) {
|
|
162
|
+
if (fs.existsSync(source)) return null;
|
|
163
|
+
const fileName = source.replace(layoutsDir + "/", "");
|
|
164
|
+
return `\0gxp-layout-fallback:${fileName}`;
|
|
165
|
+
}
|
|
166
|
+
return null;
|
|
159
167
|
},
|
|
160
168
|
load(id) {
|
|
161
169
|
if (!id.startsWith("\0gxp-layout-fallback:")) return null;
|