Skip to content
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

Publish ESM and improve support for Vite #1225

Open
daniel-ac-martin opened this issue Dec 12, 2024 · 2 comments
Open

Publish ESM and improve support for Vite #1225

daniel-ac-martin opened this issue Dec 12, 2024 · 2 comments

Comments

@daniel-ac-martin
Copy link
Owner

Vite seems to be less forgiving with regards to CJS modules, and won't allow named imports from them.

This means that consumers can't import in the same way that we do within this repo (which uses the raw TypeScript).

We probably need to publish ESM alongside the CJS and allow Vite to chose which it wants to use.

We should avoid publishing only ESM as that means that all consumers need to be ESM themselves.

@daniel-ac-martin
Copy link
Owner Author

daniel-ac-martin commented Dec 12, 2024

I've previously implemented dual packages here: staylor/react-helmet-async#235

Previously there has been a suggestion that shims should be preferred over dual packages. See:

@daniel-ac-martin
Copy link
Owner Author

Most likely this would be the easiest approach: https://github.com/nodejs/package-examples?tab=readme-ov-file#approach-2-isolate-state

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant