-
Notifications
You must be signed in to change notification settings - Fork 240
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
Support module resolution for package.json exports #122
Conversation
I'm open to the docusaurus opinion to not be what I think about the default one for node: #121 But I generally think defaulting to ESM is probably going to surprise more folks than delight for a while |
I agree. For one thing—it often complicates things if you want to import packages with |
FYI the init template of Docusaurus uses TS 4.7, and a user swizzling components will likely be exposed to APIs being declared in "exports". It will most likely happen when swizzling "unsafe" theme components importing internal apis:
I can understand that there may be surprising behaviors (in which case the user can revert to "node") but think that this use-case above should rather work automatically by default. Maybe we can give it a try and see if anyone complains. See related Docusaurus issue: facebook/docusaurus#8226 Another thing: I'm wondering if this default TS config shouldn't be versioned alongside Docusaurus. Will it always be reasonable that a default config would work fine for both Docusaurus 2.0 and future major versions? If we have to ensure this package keeps being compatible with older Docusaurus sites, wouldn't this create friction because we can't enable new defaults on newly initialized sites because it breaks old sites? Currently Relying on an external dependency with a different versioning scheme is likely to create unexpected breaking changes in the future. What if we want to apply the change in this PR, but only for the upcoming Docusaurus v3.0 sites, and not current Docusaurus v2.0 sites? |
You can apply semer to these bases also, so a bump to That's also a good idea |
If we keep config in this repo, that would be less confusion to have the same major version IMHO (ie Docusaurus v2 uses config v2) Wonder what other frameworks do. Is nextjs extending the next config of this repo? Becaues I don't see a lot of npm downloads |
It doesn't seem clear to me that a merge was what we wanted here? If it is, that's fine |
@orta I'll probably look into reinterning this config later, but in the meantime, I think it's better to merge this pr and release it thanks ;) |
@slorber @Josh-Cena I've noticed that there are packages (e.g. @docusaurus/plugin-content-docs) that are using the NPM
exports
property. However, TypeScript isn't configured in a way that allows access to these items.Given that Node 16.14 is required since 2.0.0-beta.21, I suggest that we can now add
"moduleResolution": "Node16"
.This allows the compiler and IDE to gather the proper information for usings the items in
exports
.