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

vite-plugin-electron-renderer

Package Overview
Dependencies
Maintainers
2
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-electron-renderer - npm Package Versions

13
7

0.13.11

Diff

Changelog

Source

0.13.11 (2023-03-27)

  • b0312e9 fix: use __cjs_require avoid esbuild parse require
  • dde27b7 fix: remove esbuild plugin #46
caoxie
published 0.13.10 •

Changelog

Source

0.13.10 (2023-03-26)

  • 8d2d914 fix: use __cjs_require avoid esbuild parse
caoxie
published 0.13.9 •

Changelog

Source

0.13.9 (2023-03-26)

  • 6ff0897 fix: use bare-path instead absolute-path
caoxie
published 0.13.8 •

Changelog

Source

0.13.8 (2023-03-26)

  • 9490072 docs: v0.13.8
  • d74bbd5 chore: .js -> .mjs
  • 1b75b57 refactor!: retain only the C/C++ module API 🔥
Break!

0.13.8 is very compact, keeping only the API for handling C/C++ modules.

renderer(options: RendererOptions)

export interface RendererOptions {
  /**
   * Explicitly tell Vite how to load modules, which is very useful for C/C++ modules.  
   * Most of the time, you don't need to use it when a module is a C/C++ module, you can load them by return `{ platform: 'node' }`.  
   * 
   * If you know exactly how Vite works, you can customize the return snippets.  
   * `e.g.`
   * ```js
   * renderer({
   *   resolve: (id) => `const lib = require("${id}");\nexport default lib.default || lib;`
   * })
   * ```
   * 
   * @experimental
   */
  resolve?: {
    [id: string]: (() => string | { platform: 'browser' | 'node' } | Promise<string | { platform: 'browser' | 'node' }>)
  }
}

Here is an example using serialport

import renderer from 'vite-plugin-electron-renderer'

export default {
  plugins: [
    renderer({
      resolve: {
        serialport: () => ({ platform: 'node' }),
        // Equivalent to
        // serialport: () => `const lib = require("serialport");\nexport default lib.default || lib;`
      },
    }),
  ],
}
caoxie
published 0.13.7 •

Changelog

Source

0.13.7 (2023-03-25)

  • bda7d87 feat: set electron __esModule
  • 69960bd refactor: remove cjs, external. add freeze, ignore.
  • 521d8e2 docs: resolve.alias comments
Main Changed
  1. No longer build in cjs format by default with improvements to esm.
  2. Remove the Node.js built-in module from external to be compatible with the esm build format.
caoxie
published 0.13.6 •

Changelog

Source

0.13.6 (2023-03-24)

  • 562aa20 refactor: explicitly specify the module platform
Main Changed

Since 0.13.6, Pre-Bundling have been greatly improved and Pure-JavaScript/Node.js modules no longer require any configuration - out of the box.

C/C++ modules, however, still require explicit configuration.

export default {
  plugins: [
    renderer({
      optimizeDeps: {
        resolve(args) {
          if (args.path === 'serialport') {
            return { platform: 'node' } // C/C++ module
          }
        },
      },
    }),
  ],
}
caoxie
published 0.13.5 •

Changelog

Source

0.13.5 (2023-03-23)

  • efaf706 refactor: options.optimizer -> options.optimizeDeps
  • 82bc2f7 refactor: postinstall generation built-in module
caoxie
published 0.13.4 •

Changelog

Source

0.13.4 (2023-03-22)

  • e3d737c refactor: remove rebuild .vite cache
  • 8de547b feat: better rebuild .vite cache
caoxie
published 0.13.3 •

Changelog

Source

0.13.3 (2023-03-21)

  • de584cc fix: filter virtual-module:
caoxie
published 0.13.2 •

Changelog

Source

0.13.2 (2023-03-21)

  • 7cc1abd refactor: better module type detect
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