Closed johnheroy closed 2 years ago
i think I am having this issue because I'm using absolute paths for imports in my tsconfig but the require path doesn't resolve in the transformed .js by esbuild
Add to include
option
here is a trivial example: https://github.com/johnheroy/electron-test-app
stack trace when running npm run dev
:
(node:32245) UnhandledPromiseRejectionWarning: TypeError: (0 , import_subpackage.helloWorld) is not a function
at /Users/johnheroy/Workspace/electron-vite-test/dist-electron/electron/main/index.js:45:36
wondering if there's a particular way to configure this plugin or esbuild to support writing electron process code with absolute import paths, I'm also happy to help contribute if you can point me in the right direction! 谢谢🙏
Closing because I found a way using the alias
plugin.
Thanks for the reply in https://github.com/electron-vite/vite-electron-plugin/issues/17!
I have an Electron app and want to define the implementation for an IPC api in another file besides
main/index.ts
. I defined some functions i.e.in another file
electron/main/ipc/hello-world.ts
and import this inmain/index.ts
(import { helloWorld } from 'electron/main/ipc/hello-world
) but the function is undefined at runtime.Is there any config to support including other code as ESM using this plugin?
this is what my vite config looks like: