weapp-vite
Version:
weapp-vite 一个现代化的小程序打包工具
34 lines (31 loc) • 729 B
JavaScript
import {
getCompilerContext,
resetCompilerContext,
setActiveCompilerContextKey
} from "./chunk-TS7WK45E.mjs";
import {
init_esm_shims
} from "./chunk-MDUMD5GP.mjs";
// src/createContext.ts
init_esm_shims();
async function createCompilerContext(options) {
const key = options?.key ?? "default";
if (!options?.key) {
resetCompilerContext(key);
}
setActiveCompilerContextKey(key);
const ctx = getCompilerContext(key);
const { configService, scanService, autoRoutesService } = ctx;
await configService.load(options);
if (autoRoutesService) {
await autoRoutesService.ensureFresh();
}
try {
await scanService.loadAppEntry();
} catch {
}
return ctx;
}
export {
createCompilerContext
};