Skip to content

Commit 2ee3329

Browse files
authored
docs: fix renderBuiltUrl example (#9558)
1 parent e8ffe0e commit 2ee3329

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

guide/build.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ A single static [base](#public-base-path) isn't enough in these scenarios. Vite
210210

211211
```ts
212212
experimental: {
213-
renderBuiltUrl: (filename: string, { hostType: 'js' | 'css' | 'html' }) => {
213+
renderBuiltUrl(filename: string, { hostType }: { hostType: 'js' | 'css' | 'html' }) {
214214
if (hostType === 'js') {
215215
return { runtime: `window.__toCdnUrl(${JSON.stringify(filename)})` }
216216
} else {
@@ -224,11 +224,11 @@ If the hashed assets and public files aren't deployed together, options for each
224224

225225
```ts
226226
experimental: {
227-
renderBuiltUrl(filename: string, { hostType: 'js' | 'css' | 'html', type: 'public' | 'asset' }) {
227+
renderBuiltUrl(filename: string, { hostId, hostType, type }: { hostId: string, hostType: 'js' | 'css' | 'html', type: 'public' | 'asset' }) {
228228
if (type === 'public') {
229229
return 'https://www.domain.com/' + filename
230230
}
231-
else if (path.extname(importer) === '.js') {
231+
else if (path.extname(hostId) === '.js') {
232232
return { runtime: `window.__assetsPath(${JSON.stringify(filename)})` }
233233
}
234234
else {

0 commit comments

Comments
 (0)