Skip to content

fix: using exports field in package.json #937

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

Merged
merged 3 commits into from
May 22, 2023
Merged

fix: using exports field in package.json #937

merged 3 commits into from
May 22, 2023

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Mar 8, 2023

Currently the package can not be imported in a type="module" node project (ESM) because the floating-vue package has no type set, so it is a commonjs project. Therefor all .js files are interpreted as commonjs and importing fails with:

SyntaxError: Named export 'Dropdown' not found. The requested module 'floating-vue' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

This is fixed by changing the file extension for ESM files and using correct package exports instead of never officially supported module entry point.

@antfu antfu changed the base branch from main to chore/pnpm-upgrade May 22, 2023 10:30
@antfu antfu changed the title fix: Fix exports of package to allow including in node module project fix: using exports field in package.json May 22, 2023
@antfu antfu merged commit cc2667a into Akryum:chore/pnpm-upgrade May 22, 2023
@susnux susnux deleted the fix/exports-esm branch May 31, 2023 11:37
Akryum pushed a commit that referenced this pull request May 31, 2023
* refactor: project maintanace

* fix: using `exports` field in package.json (#937)

Co-authored-by: Anthony Fu <[email protected]>

* chore: clean up

* chore: to vitepress

* feat: migrate theme editor

* chore: move files

---------

Co-authored-by: Ferdinand Thiessen <[email protected]>
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

Successfully merging this pull request may close these issues.

Crashes in ESM SSR: Cannot use import statement outside a module
2 participants