We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discovered on my action which uses ni as a package opposed to a CLI tool (which it rocks at 🚀)
ni
tinyexec contains an import of createRequire:
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
Unsure what the best approach here would be to prevent unbuild/rollup from collapsing this import alias down 🤔
The tinyexec dist contains the alias import still
tinyexec
Mainly opened this for searchability / awareness
Resolved on my end by aliasing my own createRequire
https://github.com/Codex-/ni-createRequire-bundle-issue
System: OS: macOS 14.6.1 CPU: (11) arm64 Apple M3 Pro Memory: 102.28 MB / 36.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.17.0 - ~/.asdf/installs/nodejs/20.17.0/bin/node npm: 10.8.3 - ~/.asdf/plugins/nodejs/shims/npm pnpm: 8.15.9 - ~/.asdf/installs/nodejs/20.17.0/bin/pnpm bun: 1.1.21 - ~/.bun/bin/bun Browsers: Chrome: 129.0.6668.59 Safari: 17.6
pnpm
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Discovered on my action which uses
ni
as a package opposed to a CLI tool (which it rocks at 🚀)tinyexec contains an import of
createRequire
:When
ni
generates bundles, the code gets transformed to:When bundling
ni
in a project that also declares acreateRequire
banner:Resulting in the error:
Unsure what the best approach here would be to prevent unbuild/rollup from collapsing this import alias down 🤔
The
tinyexec
dist contains the alias import stillMainly opened this for searchability / awareness
Resolved on my end by aliasing my own
createRequire
Reproduction
https://github.com/Codex-/ni-createRequire-bundle-issue
System Info
Used Package Manager
pnpm
Validations
Contributions
The text was updated successfully, but these errors were encountered: