vite-react-jsx icon indicating copy to clipboard operation
vite-react-jsx copied to clipboard

Files under `dist/esm/` should use the `.mjs` extension

Open haoqunjiang opened this issue 4 years ago • 2 comments

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 avatar Jun 22 '21 08:06 haoqunjiang

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

haoqunjiang avatar Jun 22 '21 08:06 haoqunjiang

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

smashercosmo avatar Sep 15 '21 10:09 smashercosmo