UNPKG

create-questpie-app

Version:

Bootstrap a new QUESTPIE Studio application with your choice of template and packages

35 lines (27 loc) 991 B
import { register } from 'node:module' import { fileURLToPath, pathToFileURL } from 'node:url' import path from 'node:path' const __dirname = path.dirname(fileURLToPath(import.meta.url)) const aliases = { '@payload-config': path.resolve(__dirname, 'payload.config.ts'), '@payload-types': path.resolve(__dirname, 'payload.types.ts'), '@payload-schema': path.resolve(__dirname, 'payload.schema.ts'), '@payload-zod': path.resolve(__dirname, 'payload.zod.ts'), } const cssStubPath = path.join(__dirname, 'css-stub.mjs') export async function resolve(specifier, context, nextResolve) { if (aliases[specifier]) { return { shortCircuit: true, url: pathToFileURL(aliases[specifier]).href, } } if (specifier.endsWith('.css') && !specifier.startsWith('.') && !specifier.startsWith('/')) { return { shortCircuit: true, url: `file://${cssStubPath}`, } } return nextResolve(specifier, context) } register(import.meta.url, import.meta.url)