See dist/index.mjs
and search createRequire
to see that there are 2 places where this is imported, resulting in an identifier conflict.
tinyexec contains an import of createRequire
:
import { createRequire as __tinyexec_cr } from "node:module";
const require = __tinyexec_cr(import.meta.url);
When ni
generates bundles, the code gets transformed to:
// ni.7b6d0b44.mjs
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
When bundling ni
in a project that also declares a createRequire
banner:
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
//...
import { createRequire } from "node:module";
var require2 = createRequire(import.meta.url);
Resulting in the error:
Identifier 'createRequire' has already been declared
Run nr build
/ pnpm build
to generate a new bundle