File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import type { Nitro } from "nitro/types";
66import type { PublicAsset } from "nitro/types" ;
77import { relative , resolve } from "pathe" ;
88import type { Plugin } from "rollup" ;
9- import { withTrailingSlash } from "ufo" ;
9+ import { joinURL , withTrailingSlash } from "ufo" ;
1010import { virtual } from "./virtual.ts" ;
1111
1212const readAssetHandler : Record <
@@ -42,7 +42,10 @@ export function publicAssets(nitro: Nitro): Plugin {
4242 const etag = createEtag ( assetData ) ;
4343 const stat = await fsp . stat ( fullPath ) ;
4444
45- const assetId = "/" + decodeURIComponent ( id ) ;
45+ const assetId = joinURL (
46+ nitro . options . baseURL ,
47+ decodeURIComponent ( id )
48+ ) ;
4649
4750 let encoding ;
4851 if ( id . endsWith ( ".gz" ) ) {
@@ -114,7 +117,9 @@ export function readAsset (id) {
114117 nitro . options . publicAssets
115118 . filter ( ( dir ) => ! dir . fallthrough && dir . baseURL !== "/" )
116119 . map ( ( dir ) => [
117- withTrailingSlash ( dir . baseURL ) ,
120+ withTrailingSlash (
121+ joinURL ( nitro . options . baseURL , dir . baseURL || "/" )
122+ ) ,
118123 { maxAge : dir . maxAge } ,
119124 ] )
120125 ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ const standard = defineNitroPreset(
55 entry : "./standard/runtime/server" ,
66 serveStatic : false ,
77 exportConditions : [ "import" , "default" ] ,
8+ output : {
9+ publicDir : "{{ output.dir }}/public/{{ baseURL }}" ,
10+ } ,
811 commands : {
912 preview : "npx srvx --prod ./" ,
1013 } ,
You can’t perform that action at this time.
0 commit comments