question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Out of the box Electron with Quasar Vite not working, @electron/remote module not found in preload.ts

See original GitHub issue

What happened?

Out of the box creation of brand new Quasar project with electron mode added resulting in @electron/remote module not found in electron-preload.ts, using Yarn. I’ve made just one minor modification to what comes out of the box and tried running the default app in Electron mode.

What did you expect to happen?

For the remote module to be found, its there in node_modules

Reproduction URL

https://codepen.io/

How to reproduce?

  1. Sorry, since its Electron out of the box there’s no point in sharing online as it can’t be run
  2. Create new quasar project with yarn create quasar
  3. Select Vite
  4. SCSS
  5. Pinia
  6. quasar mode add electron
  7. yarn add @electron/remote
  8. Change preload script to `import { BrowserWindow} from ‘@electron/remote
  9. Run quasar dev -m electron with devtools open
  10. See console error for unable to load module @electron/remote

Flavour

Quasar CLI (@quasar/cli | @quasar/app)

Areas

Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app), Electron Mode

Platforms/Browsers

Electron

Quasar info output

Operating System - Linux(5.19.10-xanmod1) - linux/x64
NodeJs - 16.16.0

Global packages
  NPM - 8.11.0
  yarn - 1.22.15
  @quasar/cli - 1.3.2
  @quasar/icongenie - Not installed
  cordova - Not installed

Important local packages
  quasar - 2.8.4 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
  @quasar/app-vite - 1.1.2 -- Quasar Framework App CLI with Vite
  @quasar/extras - 1.15.3 -- Quasar Framework fonts, icons and animations
  eslint-plugin-quasar - Not installed
  vue - 3.2.39 -- The progressive JavaScript framework for building modern web UI.
  vue-router - 4.1.5
  pinia - 2.0.22 -- Intuitive, type safe and flexible Store for Vue
  vuex - Not installed
  vite - 2.9.15 -- Native-ESM powered web dev build tool
  eslint - 8.24.0 -- An AST-based pattern checker for JavaScript.
  electron - 20.2.0 -- Build cross platform desktop apps with JavaScript, HTML, and CSS
  electron-packager - Not installed
  electron-builder - Not installed
  register-service-worker - 1.7.2 -- Script for registering service worker, with hooks
  @capacitor/core - Not installed
  @capacitor/cli - Not installed
  @capacitor/android - Not installed
  @capacitor/ios - Not installed

Quasar App Extensions
  *None installed*

Networking
  Host - pop-os
  wlp2s0 - 192.168.1.177

Relevant log output

Unable to load preload script: /home/davidparr/src/myquasarapp/.quasar/electron/electron-preload.js

Error: module not found: @electron/remote
    at preloadRequire (VM4 sandbox_bundle:93:1386)
    at <anonymous>:6:21
    at runPreloadScript (VM4 sandbox_bundle:93:2213)
    at Object.<anonymous> (VM4 sandbox_bundle:93:2480)
    at ./lib/sandboxed_renderer/init.ts (VM4 sandbox_bundle:93:2636)
    at __webpack_require__ (VM4 sandbox_bundle:1:170)
    at VM4 sandbox_bundle:1:1242
    at ___electron_webpack_init__ (VM4 sandbox_bundle:1:1320)
    at VM4 sandbox_bundle:160:455

Additional context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
pdanpdancommented, Sep 26, 2022

I’ll leave this open, I think we need at least a comment in the base template about this

1reaction
pdanpdancommented, Sep 26, 2022

Np, I discover the same way in an upgrade from 19 to 20 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrade guide on Electron - Quasar Framework
High overview of the improvements. Out of the box support for Typescript. Just rename electron-main.js and electron-preload.js to electron-main.ts ...
Read more >
How do I use require('electron') in a quasar vue component ...
Quasar's suggestion is to use a preload script to attach the node APIs that you want in your renderer processes (ie: BrowserWindows) to...
Read more >
Create a secure Electron application with TypeScript and Vite ...
Leverage the power of Vite.js to create a secure Electron application with TypeScript using any front-end framework (React, Vue 3, Svelte, .
Read more >
Quasar Live Coding Sesh - Getting Started With Quasar Vite CLI
We need a new resource for getting started with Quasar and Vite !I'm a little short on time these days as I'm working...
Read more >
Quasar Devs! You MUST Watch this. Quasar Cli Vite Has ...
Want more? https://quasarcast.com/registerListen to the QuasarLife podcast 🎙️https://quasarcast.com/podcastsCatch me on Twitter ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found