Skip to content

Commit 65a4e39

Browse files
authored
fix(config): resolve default server assets dir from serverDir (#4562)
1 parent e36e7a6 commit 65a4e39

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

docs/1.docs/50.assets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export default defineConfig({
113113
114114
## Server Assets
115115

116-
All assets in `assets/` directory will be added to the server bundle. After building your application, you can find them in the `.output/server/chunks/raw/` directory. Be careful with the size of your assets, as they will be bundled with the server bundle.
116+
All assets in the `assets/` directory (relative to [`serverDir`](/config#serverdir) when it is set, otherwise the project root) will be added to the server bundle. After building your application, you can find them in the `.output/server/chunks/raw/` directory. Be careful with the size of your assets, as they will be bundled with the server bundle.
117117

118118
> [!TIP]
119119
> Unless using `useStorage()`, assets won't be included in the server bundle.

src/config/resolvers/assets.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ export async function resolveAssetsOptions(options: NitroOptions) {
2828
for (const serverAsset of options.serverAssets) {
2929
serverAsset.dir = resolve(options.rootDir, serverAsset.dir);
3030
}
31-
// 2. Add server/ directory
31+
// 2. Add <serverDir>/assets directory
3232
options.serverAssets.push({
3333
baseName: "server",
34-
dir: resolve(options.rootDir, "assets"),
34+
dir: resolve(options.serverDir || options.rootDir, "assets"),
3535
});
3636

3737
// Infer `fallthrough` and `maxAge` from publicAssets

0 commit comments

Comments
 (0)