npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kuankuan/vite-plugin-electron

v0.0.2

Published

Make electron development in vite projects easier and more intuitive

Downloads

2

Readme

VitePluginElectron

VitePluginElectron是用于简化Electron项目开发的Vite插件。

特性

  • 使用 npm run dev 自动启动Electron
  • 渲染进程和主进程的热重载
  • 使用 npm run preview 自动打开Electron
  • 使用 npm run build 自动进行Electron打包

安装

npm install @kuankuan/vite-plugin-electron --D

使用

配置

在你的 vite.config.js 文件中添加以下配置:

import vitePluginElectron from "vite-plugin-electron";

export default {
  plugins: [
    vitePluginElectron({
      electronBuilder: {
        config: {
          files: ["**/*"],
          asar: true,
          productName: "yourAppName",
          nsis: {
            oneClick: false,
            allowToChangeInstallationDirectory: true,
          },
        },
      },
      esbuildTarget: "node18",
      main: "src/background.ts",// Electron入口文件
    }),
  ],
};

主进程

如果你当前正在运行开发服务器或预览服务器,process.argv 的第三个参数将会是一个URL。你可以通过判断 process.argv[2]===undefined 来确定当前环境,并打开开发服务器提供的URL,而不是加载index.html,像这样:

if (process.argv[2]) {
  win.loadURL(process.argv[2]);
} else {
  win.loadFile("index.html");
}

命令

  • npm run dev:启动Vite开发服务器,并自动打开Electron。
  • npm run preview:构建你的Vite项目、打开Electron,并提供打包后的应用程序。
  • npm run build:构建你的Vite项目,并使用Electron进行打包。

许可证

VitePluginElectron使用MulanPSL-2.0许可证。

问题

如果你遇到任何问题或有建议,请在GitHub存储库中提出问题。

鸣谢

VitePluginElectron由kuankuan和贡献者开发和维护。

特别感谢Vite项目和Electron社区的支持和灵感。

Gitee|Github|文档

GitHub top language GitHub issues