ipikuka
Import a module from a file in MDX
🔙 Read in 7 min., written by ipikuka
1. Import A Module
The relative link is relative to the module which MDXRemote called,
since the baseUrl is setted as import.meta.url in the options.
import random from "../../../mdxComponents/random.mjs";
| importing a module works | --> | random integer is 69 | 
|---|
2. Import A Module via dynamic import
The relative link is relative to the module which MDXRemote called,
since the baseUrl is setted as import.meta.url in the options.
export const random = (await import("../../../mdxComponents/random.mjs")).default;
| importing a module works | --> | random integer is 61 | 
|---|