I am using dynamic import in my react typescript project like this:
import { LanguageDescription } from "@codemirror/language";
export const languages: LanguageDescription[] = [
LanguageDescription.of({
name: "latex",
extensions: [
"tex",
"sty",
"Rtex",
"rtex",
"pstex",
"pstex_t",
"gin",
"fontspec",
"pygstyle",
"pygtex",
"ps_tex",
"ltx",
],
load: () => {
debugger;
return import("./latex").then((m) => {
debugger;
return m.latex();
});
},
}),
];
the latex/index.ts
file was in the same folder, when I debugging this file in my local machine, shows error:
TypeError: Failed to fetch dynamically imported module: http://dev-tex.example.com/src/component/common/editor/foundation/languages/latex/index.ts?t=1723298528347
when I publish this project to production, it works fine. why this dynamic import did not work in local machine? I have read this issue https://github.com/vitejs/vite/issues/11804 and tried to disable the adblocker but did not fixed this issue.