Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Files under dist/esm/ should use the .mjs extension #5

Open
haoqunjiang opened this issue Jun 22, 2021 · 2 comments
Open

Files under dist/esm/ should use the .mjs extension #5

haoqunjiang opened this issue Jun 22, 2021 · 2 comments

Comments

@haoqunjiang
Copy link

Being present in the exports field of package.json does not automatically make the file an ES module. It must be ended with .mjs, or the package.json has to include type: "module".

https://nodejs.org/api/packages.html#packages_determining_module_system

@haoqunjiang
Copy link
Author

This issue makes the plugin unusable inside vite.config.mjs.

@smashercosmo
Copy link

Can't use it in vite.config.ts either. Getting

(node:78771) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
import resolve from 'resolve';
^^^^^^

SyntaxError: Cannot use import statement outside a module

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

No branches or pull requests

2 participants