Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-electron-x

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-electron-x

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

  • 1.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 21 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc