dayjs-resolve-hook.mjs 344 B

12345678910
  1. const DAYJS_SUBPATH_RE = /^dayjs\/(plugin|locale)\/([^./]+)$/;
  2. /** @type {import('node:module').ResolveHook} */
  3. export async function resolve(specifier, context, nextResolve) {
  4. const match = specifier.match(DAYJS_SUBPATH_RE);
  5. if (match) {
  6. return nextResolve(`${specifier}.js`, context);
  7. }
  8. return nextResolve(specifier, context);
  9. }