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

Vite CJS Node API is deprecated #255

Open
julien3 opened this issue Sep 25, 2024 · 1 comment
Open

Vite CJS Node API is deprecated #255

julien3 opened this issue Sep 25, 2024 · 1 comment

Comments

@julien3
Copy link

julien3 commented Sep 25, 2024

When I switched to Electron 28+, I followed the instructions here and added "type": "module" to package.json on my project.

Since then, my vite.config.ts is erroneous on VS Code due to the electron function call within the configuration:

This expression is not callable.
Type 'typeof import("[...]/node_modules/vite-plugin-electron/dist/index")' has no call signatures.ts(2349)

When I build this project, I get a warning:

The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.

If I add "type": "module" to package.json on this project (plus minor import adjustments), my issue above gets fixed and VS Code doesn't complain anymore. Any reason both vite-plugin-electron and vite-plugin-electron-renderer don't include "type": "module" now Vite/Electron require it?

@hifron
Copy link

hifron commented Sep 28, 2024

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

2 participants