Replies: 3 comments
-
You can do it like this: import { resolve } from 'node:path';
import { defineConfig, externalizeDepsPlugin } from 'electron-vite';
const alias = {
'@root': __dirname,
'@m/': __dirname + '/apps/main/src/',
'@r/': __dirname + '/apps/render/src/',
}
export default defineConfig({
main: {
resolve: {
alias
},
},
preload: {
resolve: {
alias
},
},
renderer: {
resolve: {
alias
},
},
}); |
Beta Was this translation helpful? Give feedback.
-
Sure, this was more an example, I have a bunch of shared configuration. Therefore i am having 4 vite configuration files and i merge from the master file configurations used in renderer, main and preload. I am using lodash`s merge to bring them all together. Subscections configs overrule the main one. |
Beta Was this translation helpful? Give feedback.
-
I can understand your idea, but public configuration is easy to confuse and understand. Because the Vite configuration itself has many default configurations, there will be many conflicts when parsing each node configuration and merging with the public configuration. |
Beta Was this translation helpful? Give feedback.
-
Clear and concise description of the problem
A common section for main/preload/render would be useful to prevent code duplication, e.g. when using shared alisases:
Suggested solution
Following this structure:
Alternative
No response
Additional context
No response
Validations
Beta Was this translation helpful? Give feedback.
All reactions