-
Notifications
You must be signed in to change notification settings - Fork 22
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
Generated ESM module is missing the Icons and Spots namespaces #198
Comments
Just to be clear: I am nowhere near confident that my diagnosis is correct. I do have a work-around, you can use the {
"compilerOptions": {
"moduleResolution": "node",
"target": "ES2020",
"baseUrl": "./",
"paths": {
"@stackoverflow/stacks-icons/icons": ["node_modules/@stackoverflow/stacks-icons/dist/icons"]
}
},
"files": ["index.ts"]
} That's the same |
We are using package.json subpath exports in stacks-icons to map paths to specific entrypoints: You are using For more context: microsoft/TypeScript#51901 |
Durn, I could have sworn I had tried the I'm creating user scripts that inject into Stack Exchange, so the final output is self-contained and I had not given this parameter enough thought. |
The generated
index.esm.js
file lacks namespaces and conflicts with the typescript definitions.The distributed module contents only define the names found inside the
icons
andspots
modules, which then are all exported as is. Because of this, you can't actually useimport { IconFaceMindBlown } from "@stackoverflow/stacks-icons/icons";
as the documentation claims.Instead, you get an error:
You can't simply use
import { IconFaceMindBlown } from "@stackoverflow/stacks-icons";
as the type information tells typescript that at that level onlyIcons
andSpots
are available.To reproduce, in an empty directory create the following three files:
package.json
tsconfig.json
index.ts
then run
The text was updated successfully, but these errors were encountered: