mirror of
https://github.com/alex8088/electron-vite.git
synced 2026-07-08 15:11:07 +08:00
Compare commits
2 Commits
b71bf82f02
...
4f796e4c8a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f796e4c8a | ||
|
|
3def0ed84b |
@ -275,7 +275,7 @@ export function bytecodePlugin(options: BytecodeOptions = {}): Plugin | null {
|
||||
}
|
||||
|
||||
const getBytecodeLoaderBlock = (chunkFileName: string): string => {
|
||||
return `require("${toRelativePath(bytecodeModuleLoader, chunkFileName)}");`
|
||||
return `require("${toRelativePath(bytecodeModuleLoader, normalizePath(chunkFileName))}");`
|
||||
}
|
||||
|
||||
await Promise.all(
|
||||
|
||||
@ -49,6 +49,11 @@ export function electronMainVitePlugin(options?: ElectronPluginOptions): Plugin[
|
||||
const nodeTarget = getElectronNodeTarget()
|
||||
|
||||
const defaultConfig = {
|
||||
resolve: {
|
||||
browserField: false,
|
||||
mainFields: ['module', 'jsnext:main', 'jsnext'],
|
||||
conditions: ['node']
|
||||
},
|
||||
build: {
|
||||
outDir: path.resolve(root, 'out', 'main'),
|
||||
target: nodeTarget,
|
||||
@ -83,6 +88,8 @@ export function electronMainVitePlugin(options?: ElectronPluginOptions): Plugin[
|
||||
const buildConfig = mergeConfig(defaultConfig.build, build)
|
||||
config.build = buildConfig
|
||||
|
||||
config.resolve = mergeConfig(defaultConfig.resolve, config.resolve || {})
|
||||
|
||||
config.define = config.define || {}
|
||||
config.define = { ...processEnvDefine(), ...config.define }
|
||||
|
||||
@ -151,6 +158,11 @@ export function electronPreloadVitePlugin(options?: ElectronPluginOptions): Plug
|
||||
const nodeTarget = getElectronNodeTarget()
|
||||
|
||||
const defaultConfig = {
|
||||
resolve: {
|
||||
browserField: false,
|
||||
mainFields: ['module', 'jsnext:main', 'jsnext'],
|
||||
conditions: ['node']
|
||||
},
|
||||
build: {
|
||||
outDir: path.resolve(root, 'out', 'preload'),
|
||||
target: nodeTarget,
|
||||
@ -185,6 +197,8 @@ export function electronPreloadVitePlugin(options?: ElectronPluginOptions): Plug
|
||||
const buildConfig = mergeConfig(defaultConfig.build, build)
|
||||
config.build = buildConfig
|
||||
|
||||
config.resolve = mergeConfig(defaultConfig.resolve, config.resolve || {})
|
||||
|
||||
config.define = config.define || {}
|
||||
config.define = { ...processEnvDefine(), ...config.define }
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user