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

[Bug Report]: can't use 'vite-plugin-electron-renderer' in farm #1977

Open
L-x-C opened this issue Nov 30, 2024 · 3 comments
Open

[Bug Report]: can't use 'vite-plugin-electron-renderer' in farm #1977

L-x-C opened this issue Nov 30, 2024 · 3 comments
Labels
scope: vite plugins Improving compatibility with vite

Comments

@L-x-C
Copy link

L-x-C commented Nov 30, 2024

Steps to reproduce

in farm.config.js

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import renderer from 'vite-plugin-electron-renderer'
export default defineConfig({
  plugins: [
    vue(), 
    renderer()
  ],
})

shows

[ Farm ] Error: Failed to start the server
Caused by: Error: Vite plugin 'vite-plugin-electron-renderer' is not compatible with Farm for now. Because it uses viteConfig.build['commonjsOptions'] which is not supported by Farm. Current supported keys are: outDir,sourcemap,minify,cssMinify,ssr,watch,rollupOptions,assetsDir

i have a web project used in electron's browserWindow, in vite, i use vite-plugin-electron-renderer. is there a way to use in farm?
In my web project

import pidusage from 'pidusage'
console.log(pidusage)

or is there a way to make this work?

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 AMD Ryzen 7 7840HS w/ Radeon 780M Graphics
    Memory: 2.47 GB / 11.72 GB
  Binaries:
    Node: 20.10.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (131.0.2903.51)
    Internet Explorer: 11.0.26100.1882
@fu050409 fu050409 added the scope: vite plugins Improving compatibility with vite label Nov 30, 2024
@ErKeLost
Copy link
Member

I checked to see if the api is compatible. Electron farm has its own plugin you can try example

@L-x-C
Copy link
Author

L-x-C commented Dec 1, 2024

I checked to see if the api is compatible. Electron farm has its own plugin you can try example

you mean @farmfe/js-plugin-electron? it's not suitable for this situation, this is a online web project that opened in electron's BrowserWindow
In webpack, i will use

target: 'electron-render'

In vite, i will use

'vite-plugin-electron-renderer'

@ErKeLost
Copy link
Member

ErKeLost commented Dec 2, 2024

@L-x-C Okay, forgive me if I don't know enough about electron, and we'll try solve this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: vite plugins Improving compatibility with vite
Projects
None yet
Development

No branches or pull requests

3 participants