You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extensionless subpath require()s, from a package with a subpath folder mappings for that subpath, resolves the file by appending the extension.
Actual Behavior
Error: Could not load /home/runner/rollup-plugin-repro/node_modules/extract-files/public/extractFiles (imported by input.js): ENOENT: no such file or directory, open '/home/runner/rollup-plugin-repro/node_modules/extract-files/public/extractFiles'
This will return (from 1.8) file:///…/node_modules/extract-files/public/extractFiles. PACKAGE_EXPORTS_RESOLVE will thus return { resolved: "file:///…/node_modules/extract-files/public/extractFiles", exact: false }.
Back to https://nodejs.org/api/modules.html#modules_all_together, we'll end up in
So, this is a combination of using node-resolve, commonjs, extensionless requires, and a package using the deprecated subpath folder mappings. Had the extract-files package used subpath patterns, it would have ended up in RESOLVE_ESM_MATCH with exact: true, making the file extension mandatory.
The text was updated successfully, but these errors were encountered:
Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it. ⓘ
Expected Behavior
Extensionless subpath
require()
s, from a package with a subpath folder mappings for that subpath, resolves the file by appending the extension.Actual Behavior
Additional Information
Copied from #684 (comment):
Following https://nodejs.org/api/modules.html#modules_all_together,
require("extract-files/public/extractFiles")
will end up callingFollowing https://nodejs.org/api/esm.html#esm_resolver_algorithm_specification, this will call
which will then call (from 3.2.3)
This will return (from 1.8)
file:///…/node_modules/extract-files/public/extractFiles
.PACKAGE_EXPORTS_RESOLVE
will thus return{ resolved: "file:///…/node_modules/extract-files/public/extractFiles", exact: false }
.Back to https://nodejs.org/api/modules.html#modules_all_together, we'll end up in
and because of
exact: false
, Node would correctly add the.js
extension and findfile:///…/node_modules/extract-files/public/extractFiles.js
.Webpack 5 had the same issue, and changed behavior last October: webpack/enhanced-resolve#256
So, this is a combination of using node-resolve, commonjs, extensionless requires, and a package using the deprecated subpath folder mappings. Had the
extract-files
package used subpath patterns, it would have ended up inRESOLVE_ESM_MATCH
withexact: true
, making the file extension mandatory.The text was updated successfully, but these errors were encountered: