pack: add preload example

This commit is contained in:
leejooy96 committed 2022-11-09 10:02:23 +09:00
1 parent 4836fbeb7d
commit f6b899ab73
3 files changed
+8 -2

No files matched your search

+2 -1
View File
@@ -10,7 +10,8 @@ export default class Constants {
static DEFAULT_WEB_PREFERENCES = { static DEFAULT_WEB_PREFERENCES = {
nodeIntegration: true, nodeIntegration: true,
contextIsolation: false, contextIsolation: false,
nodeIntegrationInWorker: true nodeIntegrationInWorker: true,
preload: join(__dirname, '../preload/index.js')
} }
static APP_INDEX_URL_DEV = 'http://localhost:5173/index.html' static APP_INDEX_URL_DEV = 'http://localhost:5173/index.html'
+5
View File
@@ -0,0 +1,5 @@
const main = (): void => {
console.log('[Preload] Script loaded.')
}
main()
+1 -1
View File
@@ -40,7 +40,7 @@ export default defineConfig({
// Docs: https://github.com/electron-vite/vite-plugin-electron // Docs: https://github.com/electron-vite/vite-plugin-electron
electronPlugin([ electronPlugin([
{ {
entry: ['src/preload/index.js'], entry: ['src/preload/index.ts'],
vite: { vite: {
build: { build: {
outDir: 'dist/preload' outDir: 'dist/preload'