@@ -123,7 +123,7 @@ export const createEntryFile = async (
123
123
// If no function is provided in the strategy, the createHTMLEntryFileChunks is used by default
124
124
const chunkGenerationFunction =
125
125
strategy . entry ?. chunkGenerationFunction || createHTMLEntryFileChunks
126
- const { assetsPrefix } = entryFileOptions
126
+ const { assets } = entryFileOptions
127
127
const options = { ...strategy . entry ?. options , ...entryFileOptions }
128
128
129
129
const appRootOverride = ( options && options . appRootOverride ) || null
@@ -132,7 +132,7 @@ export const createEntryFile = async (
132
132
const customHeadContent = ( options && options . customHeadContent ) || null
133
133
const customTags = ( options && options . customTags ) || [ ]
134
134
const chunks = chunkGenerationFunction ( uidl , {
135
- assetsPrefix ,
135
+ assets ,
136
136
appRootOverride,
137
137
customHeadContent,
138
138
customTags,
@@ -147,7 +147,7 @@ const createHTMLEntryFileChunks = (
147
147
uidl : ProjectUIDL ,
148
148
options : EntryFileOptions
149
149
) : Record < string , ChunkDefinition [ ] > => {
150
- const { assetsPrefix = '' , appRootOverride, customHeadContent, customTags } = options
150
+ const { appRootOverride, customHeadContent, customTags } = options
151
151
const { settings, meta, assets, manifest, customCode } = uidl . globals
152
152
153
153
const htmlNode = HASTBuilders . createHTMLNode ( 'html' )
@@ -207,14 +207,18 @@ const createHTMLEntryFileChunks = (
207
207
if ( manifest ) {
208
208
const linkTag = HASTBuilders . createHTMLNode ( 'link' )
209
209
HASTUtils . addAttributeToNode ( linkTag , 'rel' , 'manifest' )
210
- HASTUtils . addAttributeToNode ( linkTag , 'href' , `${ options . assetsPrefix } /manifest.json` )
210
+ HASTUtils . addAttributeToNode (
211
+ linkTag ,
212
+ 'href' ,
213
+ UIDLUtils . prefixAssetsPath ( '/manifest.json' , options . assets )
214
+ )
211
215
HASTUtils . addChildNode ( headNode , linkTag )
212
216
}
213
217
214
218
meta . forEach ( ( metaItem ) => {
215
219
const metaTag = HASTBuilders . createHTMLNode ( 'meta' )
216
220
Object . keys ( metaItem ) . forEach ( ( key ) => {
217
- const prefixedURL = UIDLUtils . prefixAssetsPath ( assetsPrefix , metaItem [ key ] )
221
+ const prefixedURL = UIDLUtils . prefixAssetsPath ( metaItem [ key ] , options . assets )
218
222
HASTUtils . addAttributeToNode ( metaTag , key , prefixedURL )
219
223
} )
220
224
HASTUtils . addChildNode ( headNode , metaTag )
@@ -223,7 +227,7 @@ const createHTMLEntryFileChunks = (
223
227
assets . forEach ( ( asset ) => {
224
228
let assetPath
225
229
if ( 'path' in asset ) {
226
- assetPath = UIDLUtils . prefixAssetsPath ( options . assetsPrefix , asset . path )
230
+ assetPath = UIDLUtils . prefixAssetsPath ( asset . path , options . assets )
227
231
}
228
232
229
233
// link canonical for SEO
@@ -347,7 +351,10 @@ const createHTMLEntryFileChunks = (
347
351
}
348
352
349
353
// Creates a manifest json file with the UIDL having priority over the default values
350
- export const createManifestJSONFile = ( uidl : ProjectUIDL , assetsPrefix ?: string ) : GeneratedFile => {
354
+ export const createManifestJSONFile = (
355
+ uidl : ProjectUIDL ,
356
+ assets : GeneratorOptions [ 'assets' ]
357
+ ) : GeneratedFile => {
351
358
const manifest = uidl . globals . manifest
352
359
const projectName = uidl . name
353
360
const defaultManifest : WebManifest = {
@@ -358,7 +365,7 @@ export const createManifestJSONFile = (uidl: ProjectUIDL, assetsPrefix?: string)
358
365
}
359
366
360
367
const icons = manifest . icons . map ( ( icon ) => {
361
- const src = UIDLUtils . prefixAssetsPath ( assetsPrefix || '' , icon . src )
368
+ const src = UIDLUtils . prefixAssetsPath ( icon . src , assets )
362
369
return { ...icon , src }
363
370
} )
364
371
0 commit comments