-
-
Notifications
You must be signed in to change notification settings - Fork 833
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
Error with new exports field on package.json #1019
Comments
I quote myself here:
Of course, something had to break! :D The problem seems to stem from the fact that "exports" is a 1:1 map. Everything that is not defined in "exports" is not exported. The solution seems to be here nodejs/node#39635. The components that you are directly importing need to be explicitly exported (at least for ESM): {
"exports": {
"./dist/themes/*": "./dist/themes/*.css",
"./dist/components/*/*": "./dist/components/*/*.js"
}
} Can you try adding those exports? |
Also hit this yesterday, was about to file myself. But I was wondering if this might be an opportunity to remove the {
"exports": {
"./themes/*.css": "./dist/themes/*.css",
"./components/*.js": "./dist/components/*.js"
}
} Imports would now look like this import '@shoelace-style/shoelace/themes/light.css';
import '@shoelace-style/shoelace/components/button/button.js'; |
@tao-cumplido @samuelstroschein I tested some variations: "./dist/components/*/*.js": "./dist/components/*/*.js", ERROR in ./src/externals/vendors.js 85:0-73
Module not found: Error: Package path ./dist/components/icon/icon.js is not exported from package C:\Programacao\platform-cortex\modules\competitiva\frontend\node_modules\@cortex-intelligence\design-system (see exports field in C:\Programacao\platform-cortex\modules\competitiva\frontend\node_modules\@cortex-intelligence\design-system\package.json) "./dist/components/*.js": "./dist/components/*.js", ERROR in ./src/externals/vendors.js 85:0-73
Module not found: Error: Package path ./dist/components/icon/icon.js is not exported from package C:\Programacao\platform-cortex\modules\competitiva\frontend\node_modules\@cortex-intelligence\design-system (see exports field in C:\Programacao\platform-cortex\modules\competitiva\frontend\node_modules\@cortex-intelligence\design-system\package.json) The only way that seens to work is (or without dist folder, but would require all the users to change their imports, is that wanted?): "exports": {
".": {
"types": "./dist/shoelace.d.ts",
"import": "./dist/shoelace.js"
},
"./dist/themes/*": "./dist/themes/*",
"./dist/components/*": "./dist/components/*",
"./dist/utilities/*": "./dist/utilities/*",
"./dist/react/*": "./dist/react/*",
"./dist/translations/*": "./dist/translations/*"
}, I included the utilities, that is needed to |
I'd love to remove
The entry points listed here are the ones we want to make sure to cover. Lines 49 to 62 in c40b3a8
|
@claviska what about this? "exports": {
".": {
"types": "./dist/shoelace.d.ts",
"import": "./dist/shoelace.js"
},
"./dist/shoelace.js": "./dist/shoelace.js",
"./dist/themes/*": "./dist/themes/*",
"./dist/components/*": "./dist/components/*",
"./dist/utilities/*": "./dist/utilities/*",
"./dist/react/*": "./dist/react/*",
"./dist/translations/*": "./dist/translations/*",
"./shoelace.js": "./dist/shoelace.js",
"./themes/*": "./dist/themes/*",
"./components/*": "./dist/components/*",
"./utilities/*": "./dist/utilities/*",
"./react/*": "./dist/react/*",
"./translations/*": "./dist/translations/*"
}, This way it will work with or without dist folder, making it backward compatible.. |
I’d rather just remove it and break it before 2.0 stable. Less confusing for users long term. |
Ok, but it would require update it in the docs aswell... |
Yep, I'm happy to take that on. Do you want to PR the exports change and I can tackle the docs after? |
Sure. |
* Fix mapping in exports Fixes #1019 - Add correct mapping for public entrypoints. * Remove shoelace.js from from exports list Should still works fine while importing this way: import { thing } from '@shoelace-style/shoelace';
Describe the bug
i recently created a fork of shoelace and while testing it out, we are seeing a error that does not happens in production release but happens on new versions built... Looks like it is related to this PR
If i remove the new exports block, it work fine... i'm missing anything?
To Reproduce
I trying to import a fresh fork of this project to a existing project, like this:
Demo
Tell me if its required, if so i create it.
Screenshots
If applicable, add screenshots to help explain the bug.
Browser / OS
Additional information
The text was updated successfully, but these errors were encountered: