Socket
Socket
Sign inDemoInstall

nuxt-electron

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-electron - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

19

index.js

@@ -6,8 +6,16 @@ "use strict";

const index = kit.defineNuxtModule({
meta: {
name: "nuxt-electron",
configKey: "electron",
compatibility: {
nuxt: ">=3.0.0"
}
},
defaults: {
include: ["electron"],
outDir: "dist-electron"
},
setup(options, nuxt) {
var _a, _b, _c;
const isProduction = process.env.NODE_ENV === "production";
options.outDir ?? (options.outDir = "dist-electron");
options.watch ?? (options.watch = {});
options.plugins ?? (options.plugins = []);
nuxt.options.ssr = false;

@@ -26,5 +34,9 @@ if (isProduction) {

nuxt.hooks.addHooks({
// For development
listen(server, listener) {
options.watch ?? (options.watch = {});
options.plugins ?? (options.plugins = []);
const addressInfo = server.address();
Object.assign(process.env, {
// This is required, and it is used in Electron-Main.
VITE_DEV_SERVER_URL: `http://localhost:${addressInfo.port}`

@@ -40,2 +52,3 @@ });

},
// For build
"build:done"() {

@@ -42,0 +55,0 @@ if (isProduction)

14

package.json
{
"name": "nuxt-electron",
"version": "0.3.1",
"version": "0.4.0",
"description": "Nuxt Integration with Electron",

@@ -30,8 +30,8 @@ "main": "index.mjs",

"devDependencies": {
"@types/node": "^18.11.18",
"esbuild": "^0.16.12",
"nuxt": "^3.0.0",
"typescript": "^4.9.4",
"vite": "^4.0.3",
"vite-electron-plugin": "^0.7.1"
"@types/node": "^18.13.0",
"esbuild": "^0.17.8",
"nuxt": "^3.2.0",
"typescript": "^4.9.5",
"vite": "^4.1.1",
"vite-electron-plugin": "^0.7.4"
},

@@ -38,0 +38,0 @@ "files": [

@@ -1,2 +0,2 @@

# nuxt-electron
# Nuxt Electron

@@ -10,4 +10,12 @@ Integrate Nuxt and Electron

## Install
## Features
- 🚀 High-performance (Not Bundle, based on esbuild)
- 📦 Out of the box
- 🔥 Hot restart
## Quick Setup
1. Add the following dependency to your project
```sh

@@ -17,11 +25,39 @@ npm i -D nuxt-electron vite-electron-plugin electron electron-builder

## Examples
2. Add `nuxt-electron` to the modules section of `nuxt.config.ts`
- [quick-start](https://github.com/caoxiemeihao/nuxt-electron/tree/main/examples/quick-start)
- [nuxt-electron-trpc-prisma](https://github.com/gurvancampion/nuxt-electron-trpc-prisma)
```ts
export default defineNuxtConfig({
modules: [
['nuxt-electron'],
],
})
```
## Usage
That's it! You can now use Electron in your Nuxt app ✨
nuxt.config.ts
## Recommend structure
Let's use the official [nuxt-starter-v3](https://codeload.github.com/nuxt/starter/tar.gz/refs/heads/v3) template as an example
```diff
+ ├─┬ electron
+ │ └── main.ts
├─┬ public
│ └── favicon.ico
├── .gitignore
├── .npmrc
├── index.html
├── app.vue
├── nuxt.config.ts
├── package.json
├── README.md
└── tsconfig.json
```
## ElectronOptions
> This is based on the `vite-electron-plugin`, see the **[Documents](https://github.com/electron-vite/vite-electron-plugin#configuration)** for more detailed options
Here is the default `nuxt-electron` options
```ts

@@ -34,2 +70,3 @@ import type { ElectronOptions } from 'nuxt-electron'

include: ['electron'],
outDir: 'dist-electron',
}],

@@ -40,5 +77,8 @@ ],

This is based on the `vite-electron-plugin` package, see the **[Documents](https://github.com/electron-vite/vite-electron-plugin#configuration)** for more detailed configuration information.
## Examples
- [quick-start](https://github.com/caoxiemeihao/nuxt-electron/tree/main/examples/quick-start)
- [nuxt-electron-trpc-prisma](https://github.com/gurvancampion/nuxt-electron-trpc-prisma)
## Notes
By default, we force the App to run in SPA mode since we don't need SSR for desktop apps.
By default, we force the App to run in SPA mode since we don't need SSR for desktop apps
import { type Configuration } from 'vite-electron-plugin';
export interface ElectronOptions extends Configuration {
export interface ElectronOptions extends Partial<Configuration> {
}
declare const _default: any;
export default _default;

Sorry, the diff of this file is not supported yet

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