Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

Codex-/ni-createRequire-bundle-issue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bundling ni createRequire conflict reproduction

See dist/index.mjs and search createRequire to see that there are 2 places where this is imported, resulting in an identifier conflict.

Issue

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

Building

Run nr build / pnpm build to generate a new bundle

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published