-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
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
Fixing DEP0148: Folder mappings in "exports" (trailing "/") leads to Error: Cannot find module #50048
Comments
It would be helpful if you were able to provide a simpler repro, one that doesn't require to download code from the internet, and maybe with fewer files also. /// ./dist/folder1/index.mjs
export const a = 1; /// ./entry.mjs
import { a } from 'pkg/folder1';
console.log({ a }); {
"name": "pkg",
"exports": {
"./package.json": "./package.json",
".": "./dist/index.mjs",
"./*/": "./dist/*/index.mjs",
"./*": "./dist/*.mjs"
}
} |
Hi @aduh95, |
Thanks! Unfortunately, I think everything is working as expected. The goal is that resolution algorithm should not need to make any FS call to get the complete URL, and the file could even be created on the fly between the resolution and the load call. That's why you need to either define an explicit /cc @nodejs/loaders can someone confirm if my understanding is correct? |
@aduh95 thanks for response. So, is there really no other way than explicitly specifying all folder paths in the package.json's /cc @nodejs/loaders |
I believe the CJS-like resolution you're trying to do here is explicitly not supported for, among other reasons, what aduh95 said. |
It makes sense, thank you for help @aduh95 @JakobJingleheimer |
Version
v16.20.2
Platform
Linux user 5.15.0-84-generic #93~20.04.1-Ubuntu SMP Wed Sep 6 16:15:40 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
Steps to reproduce:
exports
innode_modules/pkg-subpath-exports-issue/package.json
:How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
console.log({ a })
outputs{ a : 1 }
to the consoleWhat do you see instead?
Additional information
I'm trying to address
DEP0148: Folder mappings in "exports" (trailing "/")
warning by using subpath patterns. Unfortunately, changingexports
leads to module not found error.I've also tried to change the
exports
config this way:Unfortunately, this configuration still leads to an error
The text was updated successfully, but these errors were encountered: