8000 chore: make imageLoader fs-dev override work in monorepo (#861) · opennextjs/opennextjs-aws@1b78890 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1b78890

Browse files
sommeeeerconico974
andauthored
chore: make imageLoader fs-dev override work in monorepo (#861)
* chore: make fs-dev imageLoader work in monorepo * Create giant-rockets-clean.md --------- Co-authored-by: conico974 <nicodorseuil@yahoo.fr>
1 parent c2da3a8 commit 1b78890

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.changeset/giant-rockets-clean.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/aws": patch
3+
---
4+
5+
fix: make fs-dev imageLoader work in monorepo

packages/open-next/src/overrides/imageLoader/fs-dev.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import fs from "node:fs";
2+
import path from "node:path";
3+
24
import type { ImageLoader } from "types/overrides";
5+
import { getMonorepoRelativePath } from "utils/normalize-path";
36

47
export default {
58
name: "fs-dev",
69
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);
912
const contentType = url.endsWith(".png") ? "image/png" : "image/jpeg";
1013
return {
1114
body,

0 commit comments

Comments
 (0)
0