mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-31 20:16:36 +08:00
better resolveElectron comment
This commit is contained in:
parent
f1ae1ad2a1
commit
8f73119ebb
@ -11,7 +11,16 @@ export default defineConfig({
|
||||
root: join(__dirname, '../src/renderer'),
|
||||
plugins: [
|
||||
vue(),
|
||||
resolveElectron(),
|
||||
resolveElectron(
|
||||
/**
|
||||
* you can custom other module in here
|
||||
* 🚧 need to make sure custom-resolve-module in `dependencies`, that will ensure that the electron-builder can package them correctly
|
||||
* @example
|
||||
* {
|
||||
* 'electron-store': 'const Store = require("electron-store"); export defalut Store;',
|
||||
* }
|
||||
*/
|
||||
),
|
||||
],
|
||||
base: './',
|
||||
build: {
|
||||
@ -26,7 +35,7 @@ export default defineConfig({
|
||||
|
||||
// ------- For use Electron, NodeJs in Renderer-process -------
|
||||
// https://github.com/caoxiemeihao/electron-vue-vite/issues/52
|
||||
export function resolveElectron(): Plugin[] {
|
||||
export function resolveElectron(dict: Parameters<typeof resolve>[0] = {}): Plugin[] {
|
||||
const builtins = builtinModules.filter(t => !t.startsWith('_'))
|
||||
|
||||
return [
|
||||
@ -43,8 +52,7 @@ export function resolveElectron(): Plugin[] {
|
||||
resolve({
|
||||
electron: electronExport(),
|
||||
...builtinModulesExport(builtins),
|
||||
// you can custom other module in here, need to make sure it's in `dependencies`
|
||||
// 'electron-store': 'const Store = require("electron-store"); export defalut Store;'
|
||||
...dict,
|
||||
})
|
||||
]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user