question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

electron is not a function

See original GitHub issue

While I use vite-plugin-electron with Vite offical template-vue-ts, getting the following errors.

使用vite 初始模板,在vite.config.ts中调用会报错

image

image image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
caoxiemeihaocommented, Aug 2, 2022

You can try remove "type": "module" in package.json fix it.

package.json 中的 "type": "module" 去掉

0reactions
Y-qwqcommented, Oct 4, 2022

@Y-qwq v0.9.4 支持 cjs, esm 两种格式导出,等待 vite@3.1.5 的新功能上来就发。 其次支持 esm 没有用,因为 Electron 不支持 esm,反正 v0.9.4 加上 esm 省的用户总觉得好像我不支持 esm 似的。

https://github.com/electron-vite/vite-plugin-electron/tree/v0.9.4

好吧,是我之前配项目的时候下意识认为 Electron 已经支持了 esm 了 后面通过针对 Electron 主进程的代码打成 cjs 的方式解决了

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: window.require is not a function - Stack Overflow
require is not a function". Ironically require works only in main.js. Here the code Im trying to run: const electron = window.
Read more >
process.electronBinding is not a function when using initialize ...
Example project. Shows the error. Change the electron version to 10.1. 2 and run npm i and npm start again and the error...
Read more >
Solved window.require is not a function in Electron app - AWSM
Solved window.require is not a function in Electron app. I got this error when I recently tried to upgrade my Calculator which is...
Read more >
Not working with electron react boilerplate - MDBootstrap
It is working in other boilerplates like create-react-app but not in the former one.</p> <p>Error :mdbreact.esm.js:918 Uncaught TypeError: Object(.
Read more >
Using Preload Scripts - Electron
This guide will step you through the process of creating a barebones Hello World app in Electron, similar to electron/electron-quick-start.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found