alex8088 / quick-start

An easy way to start a front-end project.
MIT License
248 stars 34 forks source link

multiple windows , secondary renderer process requiring npm run build #15

Closed stuartambient closed 1 year ago

stuartambient commented 1 year ago

Describe the bug

I have a multiple windows app. I'm finding for the second renderer process, any changes I make in the code requires me to run npm run build first. Something I'm doing wrong ? Generally with the first renderer, it may have required me to restart (npm run dev) but not specifically use npm run build before.

/* ELECTRON VITE CONFIG */
import { resolve } from 'path';
import { defineConfig, externalizeDepsPlugin } from 'electron-vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
  main: {
    plugins: [externalizeDepsPlugin()]
  },
  preload: {
    plugins: [externalizeDepsPlugin()],
    build: {
      rollupOptions: {
        input: {
          index: resolve(__dirname, 'src/preload/index.js'),
          child: resolve(__dirname, 'src/preload/child.js')
        }
      }
    }
  },
  renderer: {
    resolve: {
      alias: {
        '@renderer': resolve('src/renderer/src')
      }
    },
    build: {
      rollupOptions: {
        input: {
          main: resolve(__dirname, 'src/renderer/index.html'),
          child: resolve(__dirname, 'src/renderer/child.html')
        }
      }
    },
    plugins: [react()]
  }
});```

/ RELEVANT PACKAGE.JSON / scripts": { "format": "prettier --write .", "lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix", "start": "electron-vite preview", "dev": "electron-vite dev --watch", "build": "electron-vite build", "postinstall": "electron-builder install-app-deps", "build:win": "npm run build && electron-builder --win --config", "build:mac": "npm run build && electron-builder --mac --config", "build:linux": "npm run build && electron-builder --linux --config" },```

Used Scaffolding

create-electron

Used Package Manager

npm

Validations

alex8088 commented 1 year ago

I don't not quite understand your problem. About hmr? https://evite.netlify.app/guide/hmr-in-renderer.html

stuartambient commented 1 year ago

I don't not quite understand your problem. About hmr? https://evite.netlify.app/guide/hmr-in-renderer.html

Was the hmr, got it now.