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

TypeError: electron is not a function #45

Closed
denganjia opened this issue Jul 28, 2022 · 16 comments · Fixed by #50
Closed

TypeError: electron is not a function #45

denganjia opened this issue Jul 28, 2022 · 16 comments · Fixed by #50

Comments

@denganjia
Copy link

using Vite3.0.3

@denganjia
Copy link
Author

image

@caoxiemeihao
Copy link
Member

Are kidding me?

@denganjia
Copy link
Author

Are kidding me?
我也不知道咋回事😭,我用的包管理器是 pnpm,有没有交流群,大佬

@denganjia
Copy link
Author

Are kidding me?
我也不知道咋回事😭,我用的包管理器是 pnpm,有没有交流群,大佬

image

@denganjia
Copy link
Author

denganjia commented Jul 28, 2022

我把Vite2、vite-plugin-electron升级到vite3 可以用,但是我创建一个新的 vite3+vite-plugin-electron就不行😖

@caoxiemeihao
Copy link
Member

caoxiemeihao commented Jul 28, 2022

You can retry with yarn or npm
换成 yarn 或者 npm 试试看;交流群有的,不过我不在群里 😅

@denganjia
Copy link
Author

image
image
yarn npm pnpm 都是一样的😰

@caoxiemeihao
Copy link
Member

caoxiemeihao commented Jul 28, 2022

You can use the following items
咋不用现成的模板呢?它们不香嘛

electron-vite-vue
electron-vite-react

Can you provide a minimal Deom?
要么你提供下最小化 Demo 放上来

@caoxiemeihao
Copy link
Member

@denganjia
Can you provide a minimal Demo to put on Github, I just found the same problem in Vite's Issues.
你那个报错的 Demo 方不方便放到 Github 上面来我看看,我刚在 Vite 的 Issues 中发现了同样的问题

@RayforReal
Copy link

vite 3.0.0 vite.config.ts,除了vue(),vueJsx(),其他的插件只要是function引入都会报错

@RayforReal
Copy link

我把Vite2、vite-plugin-electron升级到vite3 可以用,但是我创建一个新的 vite3+vite-plugin-electron就不行😖

vite版本问题,降低到2.9就不回有问题了,原因还不知道

@caoxiemeihao
Copy link
Member

@Balott
Vite3.0 一堆问题,到是你的问题我昨天用 3.0 试了下没复现
你能给个最小化复现 Demo 吗

@RayforReal
Copy link

@caoxiemeihao
https://github.com/BalotT/Vite_3.0_demo.git
vite init 最新版本 npm 移步 vite.config.ts

@RayforReal
Copy link

删掉package.json 中的 "type": "module"配置

@caoxiemeihao
Copy link
Member

删掉package.json 中的 "type": "module"配置

可以的 😂,那要给插件提供 exports 字段避开这个问题了。因为大部分人写插件都只会考虑 CJS 场景

@caoxiemeihao
Copy link
Member

v0.8.5 将会支持 type: module

caoxiemeihao added a commit that referenced this issue Aug 7, 2022
@caoxiemeihao caoxiemeihao mentioned this issue Aug 7, 2022
@caoxiemeihao caoxiemeihao linked a pull request Aug 8, 2022 that will close this issue
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 a pull request may close this issue.

3 participants