We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c2da3a8 commit 989f2b3Copy full SHA for 989f2b3
packages/open-next/src/overrides/imageLoader/fs-dev.ts
@@ -1,11 +1,14 @@
1
import fs from "node:fs";
2
+import path from "node:path";
3
+
4
import type { ImageLoader } from "types/overrides";
5
+import { getMonorepoRelativePath } from "utils/normalize-path";
6
7
export default {
8
name: "fs-dev",
9
load: async (url: string) => {
- const basePath = "../../assets";
- const body = fs.createReadStream(`${basePath}/${url}`);
10
+ const imagePath = path.join(getMonorepoRelativePath(), "assets", url);
11
+ const body = fs.createReadStream(imagePath);
12
const contentType = url.endsWith(".png") ? "image/png" : "image/jpeg";
13
return {
14
body,
0 commit comments