-
Notifications
You must be signed in to change notification settings - Fork 49
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
[JS] unable to import subpackages (smoldot/worker, smoldot/bytecode, etc.) with parcel #1923
Comments
Smoldot is only one package, there's no "sub-package". |
Mhh I didn't realise it could configured on the resolver. I'm not using parcel on any project, I was just trying polkadot-api with different bundlers when I ran into this. Typescript also doesn't support the exports feature if My point is that "sub-packages" (which it's not any official term, it's the word I use when you import something from a subpath of a module, like Happy to close this until someone can find any concrete example where they can't change their config to use the package.json's exports feature. |
But the entry points of smoldot are not "sub-packages". In order for them to be sub-packages, they would need to be more or less independent from each other, while in the case of smoldot the various files that define entry points are all entangled and import each other. The rationale when we made it this way is that someone who uses smoldot with old tooling can still use smoldot using its easy-to-use default entry points. Using other entry points such as |
My choice of words was not the correct one, sorry. Using your wording I meant entry point. You can see the definition I've added in the PR is not actually specifying a new package, it doesn't have a name, nor dependencies by its own. It's just adding support for those resolvers that look at the smoldot's file or directory Many other libraries, like RxJS, redux-toolkit, react-dom, or also polkadot-api have sub-path exports (or in other words, different entry points), and have this extra definition, on top of the top-level |
Some of the JS tooling is unable to resolve subpaths (
smoldot/worker
,smoldot/bytecode
,smoldot/no-auto-bytecode
). I could reproduce it with parcel in this repo + branchI think this is due to missing a specific package.json on the root of
smoldot
package, every library that exports subpackages have them defined.I'll open a PR with this.
The text was updated successfully, but these errors were encountered: