[READ-ONLY] Mirror of https://github.com/probablykasper/vite-plugin-electron-x. A Vite plugin for bundling main.ts, preload.ts and running Electron in development
0

Configure Feed

Select the types of activity you want to include in your feed.

TypeScript 96.8%
JavaScript 3.1%
Other 0.1%
28 1 5

Clone this repository

https://tangled.org/kasper.space/vite-plugin-electron-x https://tangled.org/did:plc:twmdjso2owcabqop62blh7ki
git@tangled.org:kasper.space/vite-plugin-electron-x git@tangled.org:did:plc:twmdjso2owcabqop62blh7ki

For self-hosted knots, clone URLs may differ based on your setup.



README.md

vite-plugin-electron-x#

NPM NPM Downloads Docs

A Vite plugin for bundling main.ts, preload.ts and running Electron in development.

Usage#

Add the plugin in vite.config.js like this:

export default defineConfig({
  plugins: [
    electronX({
      main: {
        // this will output ./build/electron/main.js
        entry: './src/electron/main.ts',
        outDir: './build/electron',
      },
      preload: {
        // this will output ./build/electro/preload.js
        entry: './src/electron/preload.ts',
        outDir: './build/electron',
      },
    }),
  ]
})

You can load the dev server in Electron using process.env.VITE_DEV_SERVER_URL:

if (process.env.VITE_DEV_SERVER_URL) {
  win.loadURL(`http://localhost:${process.env.VITE_DEV_SERVER_URL}`)
} else {
  // win.loadURL('your-production-output.html')
}

API#

Docs: https://paka.dev/npm/vite-plugin-electron-x

Dev instructions#

Get started#

  1. Install Node.js
  2. Run npm install

Commands#

  • npm run dev: Build and watch
  • npm run build: Build
  • npm run format: Format

Publish new version#

  1. Update CHANGELOG.md
  2. Check for errors
    npm run lint
    
  3. Bump the version number
    npm version --no-git-tag <version>
    
  4. Build the package
    npm run build
    
  5. Publish the package
    npm publish
    
  6. Commit with a tag in format "v#.#.#"
  7. Create GitHub release with release notes