Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
nuxt-electron
Advanced tools
Integrate Nuxt and Electron
# Using pnpm
pnpm add -D nuxt-electron vite-electron-plugin vite-plugin-electron-renderer electron electron-builder
# Using yarn
yarn add --dev nuxt-electron vite-electron-plugin vite-plugin-electron-renderer electron electron-builder
# Using npm
npm install --save-dev nuxt-electron vite-electron-plugin vite-plugin-electron-renderer electron electron-builder
nuxt-electron
to the modules
section of nuxt.config.ts
export default defineNuxtConfig({
modules: [
'nuxt-electron',
],
})
electron/main.ts
file and type the following codeimport { app, BrowserWindow } from 'electron'
app.whenReady().then(() => {
new BrowserWindow().loadURL(process.env.VITE_DEV_SERVER_URL)
})
main
entry to package.json
{
+ "main": "dist-electron/main.js"
}
That's it! You can now use Electron in your Nuxt app ✨
Here is the default electron
options
export default defineNuxtConfig({
modules: [
'nuxt-electron',
],
electron: {
include: ['electron'],
outDir: 'dist-electron',
},
})
Full types definition
This is based on the
vite-electron-plugin
, see the Documents for more detailed options
import type { Configuration } from 'vite-electron-plugin'
export interface ElectronOptions extends Partial<Configuration> {
/**
* @see https://github.com/electron-vite/vite-plugin-electron-renderer
*/
renderer?: Parameters<typeof import('vite-plugin-electron-renderer').default>[0]
/**
* nuxt-electron will modify some options by default
*
* ```js
* export default defineNuxtConfig({
* ssr: false,
* app: {
* buildAssetsDir: '/',
* baseURL: './',
* },
* runtimeConfig: {
* app: {
* baseURL: './',
* },
* },
* })
* ```
*/
disableDefaultOptions?: boolean
}
Let's use the official nuxt-starter-v3 template as an example
+ ├─┬ electron
+ │ └── main.ts
├─┬ public
│ └── favicon.ico
├── .gitignore
├── .npmrc
├── index.html
├── app.vue
├── nuxt.config.ts
├── package.json
├── README.md
└── tsconfig.json
By default, we force the App to run in SPA mode since we don't need SSR for desktop apps
If you want to fully customize the default behavior, you can disable it by disableDefaultOptions
0.4.4 (2023-03-29)
FAQs
Nuxt Integration with Electron
The npm package nuxt-electron receives a total of 442 weekly downloads. As such, nuxt-electron popularity was classified as not popular.
We found that nuxt-electron demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.