node-module-stub.ts 408 B

123456789101112
  1. /**
  2. * Browser stand-in for `node:module`. `createRequire` is unreachable in the
  3. * configured loader path and fails loud if that assumption changes.
  4. */
  5. /** Fail if browser boot reaches Node's module loader. */
  6. export const createRequire = (): never => {
  7. throw new Error('node:module is not available in the browser')
  8. }
  9. /** Type-only peer for the vendored loader. */
  10. export type LoadHookContext = never