UNPKG

winterspec

Version:

Write Winter-CG compatible routes with filesystem routing and tons of features

11 lines (10 loc) 466 B
/** * Loads a file created by `winterspec bundle` and returns the default export. * This is a very thin wrapper over `import()` that adds some types. */ export const loadBundle = async (bundlePath) => { const bundle = await import(bundlePath); // If the file is imported as CJS, the default export is nested. // Naming this with .mjs seems to break some on-the-fly transpiling tools downstream. return bundle.default.default ?? bundle.default; };