Remove dynamicImport and setDynamicImport

It turns out that the import expression won't actally be rewritten by
esbuild, so we can just write it directly.

While this won't help CJS emit, that already didn't work anyway, and
it's likely that this code is going to be moved outside of the codebase
into VS Code or a shared package elsewhere anyway.
This commit is contained in:
Jake Bailey
2022-11-06 18:43:25 -08:00
parent 7988e40590
commit da6f0671ae
2 changed files with 7 additions and 27 deletions

View File

@@ -125,15 +125,6 @@ export class MainProcessLogger extends BaseLogger {
}
}
let dynamicImport = async (_id: string): Promise<any> => {
throw new Error("Dynamic import not implemented");
};
/** @internal */
export function setDynamicImport(fn: (id: string) => Promise<any>) {
dynamicImport = fn;
}
/** @internal */
export function createWebSystem(host: WebHost, args: string[], getExecutingFilePath: () => string): ServerHost {
const returnEmptyString = () => "";
@@ -182,7 +173,7 @@ export function createWebSystem(host: WebHost, args: string[], getExecutingFileP
const scriptPath = combinePaths(packageRoot, browser);
try {
const { default: module } = await dynamicImport(scriptPath);
const { default: module } = await import(scriptPath);
return { module, error: undefined };
}
catch (e) {