How to use electron api on frontend

I want use api on frontend, it is ok on electron environment, but build error on browser environment.
I want to know how to use electron api correctly on frontend.

Hi @gaomin,

you can simply put all electron-frontend related code inside of a electron-browser folder at the same level as your normal browser folder. Code inside of this folder will only be bundled into the electron app, and ignored while bundling the browser app.

This is used extensively in the core package of Theia. See this code. Additionally you need to add a pointer inside of your package.json to include the dependency injection module:

thanks a lot, I resolved it.