@uniweb/runtime 0.5.16 → 0.5.17

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.jsx +15 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/runtime",
3
- "version": "0.5.16",
3
+ "version": "0.5.17",
4
4
  "description": "Minimal runtime for loading Uniweb foundations",
5
5
  "type": "module",
6
6
  "exports": {
package/src/index.jsx CHANGED
@@ -138,8 +138,22 @@ async function loadFoundation(source) {
138
138
  async function loadExtensions(urls, uniwebInstance) {
139
139
  if (!urls?.length) return
140
140
 
141
+ // Resolve extension URLs against base path for subdirectory deployments
142
+ // e.g., /effects/foundation.js → /templates/extensions/effects/foundation.js
143
+ const basePath = import.meta.env?.BASE_URL || '/'
144
+ function resolveUrl(source) {
145
+ if (basePath === '/') return source
146
+ if (typeof source === 'string' && source.startsWith('/')) {
147
+ return basePath + source.slice(1)
148
+ }
149
+ if (typeof source === 'object' && source.url?.startsWith('/')) {
150
+ return { ...source, url: basePath + source.url.slice(1) }
151
+ }
152
+ return source
153
+ }
154
+
141
155
  const results = await Promise.allSettled(
142
- urls.map(url => loadFoundation(url))
156
+ urls.map(url => loadFoundation(resolveUrl(url)))
143
157
  )
144
158
 
145
159
  for (let i = 0; i < results.length; i++) {