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
node:
What is the current behavior?
using createRequire isn't detected when imported with node: prefix. i.e. the imported module is not resolved.
createRequire
If the current behavior is a bug, please provide the steps to reproduce.
A dependency (@adobe/fetch) uses createRequire to import the package.json:
@adobe/fetch
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url); const pkg = require('../../package.json');
the generated bundle contains:
const require = (0,node_module__WEBPACK_IMPORTED_MODULE_0__.createRequire)("file:///..../node_modules/@adobe/fetch/src/core/request.js"); const pkg = require('../../package.json');
which doesn't work, since the package.json will not be available once using the bundle.
package.json
when we change the import and remove the node: prefix:
import { createRequire } from 'module'; const require = createRequire(import.meta.url); const pkg = require('../../package.json');
then bundle package.json is resolved and included in the bundle:
const require = /* createRequire() */ undefined; const pkg = __webpack_require__(/*! ../../package.json */ "./node_modules/@adobe/fetch/package.json");
What is the expected behavior?
createRequire should be detected even if it's imported via the node:module prefix.
node:module
Other relevant information: webpack version: 5.75.0 Node.js version: 18.13.0 Operating System: macOS
The text was updated successfully, but these errors were encountered:
@tripodsan Sorry for delay, is your target node? Can you show me your resolver value?
node
resolver
Sorry, something went wrong.
hi @alexander-akait, how can I obtain that? here's our webpack config: https://github.com/adobe/helix-deploy/blob/a50182b1a0b4c50bc5d9e1dc6bca7245157dcbb1/src/bundler/WebpackBundler.js#L72-L81
Yeah, bug...
I think due #14166 😄 I will look can we fix it, because it is easy to catch due node: prefix
Fix - #16904
Successfully merging a pull request may close this issue.
Bug report
What is the current behavior?
using
createRequire
isn't detected when imported withnode:
prefix. i.e. the imported module is not resolved.If the current behavior is a bug, please provide the steps to reproduce.
A dependency (
@adobe/fetch
) uses createRequire to import the package.json:the generated bundle contains:
which doesn't work, since the
package.json
will not be available once using the bundle.when we change the import and remove the
node:
prefix:then bundle package.json is resolved and included in the bundle:
What is the expected behavior?
createRequire
should be detected even if it's imported via thenode:module
prefix.Other relevant information:
webpack version: 5.75.0
Node.js version: 18.13.0
Operating System: macOS
The text was updated successfully, but these errors were encountered: