File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
packages/open-next/src/overrides/imageLoader Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @opennextjs/aws " : patch
3
+ ---
4
+
5
+ fix: make fs-dev imageLoader work in monorepo
Original file line number Diff line number Diff line change 1
1
import fs from "node:fs" ;
2
+ import path from "node:path" ;
3
+
2
4
import type { ImageLoader } from "types/overrides" ;
5
+ import { getMonorepoRelativePath } from "utils/normalize-path" ;
3
6
4
7
export default {
5
8
name : "fs-dev" ,
6
9
load : async ( url : string ) => {
7
- const basePath = "../../ assets";
8
- const body = fs . createReadStream ( ` ${ basePath } / ${ url } ` ) ;
10
+ const imagePath = path . join ( getMonorepoRelativePath ( ) , " assets", url ) ;
11
+ const body = fs . createReadStream ( imagePath ) ;
9
12
const contentType = url . endsWith ( ".png" ) ? "image/png" : "image/jpeg" ;
10
13
return {
11
14
body,
You can’t perform that action at this time.
0 commit comments