{{ message }}
Repository navigation
Nuxt + Electron production build not loading frontend from #33516
Replies: 1 comment
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Hi everyone 👋,
I'm building a desktop app using Nuxt 4 + Electron, and everything works fine in development mode, but when I package the app for production, the frontend doesn't load. Instead, I get this error:
Not allowed to load local resource: file:///C:/Users/Trojan%20Technologies/AppData/Local/Programs/testapp/resources/app.asar/.output/public/index.html
🧱 Project Setup
Electron main process (main/main.js):
function createWindow() { mainWindow = new BrowserWindow({ width: 400 , height: 600, autoHideMenuBar: true, title: 'test', titleBarStyle: 'hiddenInset', closable: true, webPreferences: { contextIsolation: true, nodeIntegration: false, } }); if (!app.isPackaged) { mainWindow.loadURL('http://localhost:3000/'); } else { const indexPath = path.join(__dirname, '../.output/public/index.html'); mainWindow.loadFile(indexPath); } }Nuxt Config
import tailwindcss from "@tailwindcss/vite"; export default defineNuxtConfig({ compatibilityDate: '2025-07-15', devtools: { enabled: true }, css: ['~/assets/css/main.css'], ssr: false, app: { baseURL: '/', buildAssetsDir: '/_nuxt/', }, vite: { plugins: [tailwindcss()], }, });package.json
"scripts": { "build": "npm run compile", "dev": "concurrently \"nuxt dev\" \"npm run compile && electron out/main.js\"", "generate": "nuxt generate", "preview": "nuxt preview", "postinstall": "nuxt prepare", "compile": "tsc -p tsconfig.main.json", "build:win": "npm run build && electron-builder --win" }, "build": { "appId": "test.app", "productName": "TestApp", "files": [ "out/**/*", ".output/**/*" ], "asarUnpack": [ ".output" ], "win": { "target": ["nsis"] } }🧩 Problem
The app installs fine on Windows, but when opened, Electron throws the "Not allowed to load local resource" error — it can’t load index.html from inside .asar.
I’ve already tried:
Still, it fails to load.
❓ Question
How should I correctly load the Nuxt static build output (.output/public) inside Electron in production?
Should I be using nuxt generate or a different preset for Electron?
Or do I need to serve the .output/public folder via a local server instead of loading it as a file?
Any help or example setups would be amazing 🙏
All reactions