quasarframework / quasar

Quasar Framework - Build high-performance VueJS user interfaces in record time
https://quasar.dev
MIT License
25.9k stars 3.51k forks source link

Electron preload is not run for New Windows opened #14510

Closed jetacpp closed 2 years ago

jetacpp commented 2 years ago

What happened?

When building a Quasar app with electron, electron preload.js is launched for the main window. This is where I expose electron APIs such as IPCRenderer modules to renderer thread. Eg, window.ipcRenderer = require('electron').ipcRenderer

When I open a new window, preload script is not launched for this window. ` <q-btn flat round dense icon="more_vert" :to="{ name: 'external'}" target="_blank"

` So the code in this window cannot use electron APIs. This issue is related to Issue 7601

What did you expect to happen?

Electron preload.js is run with every window opened.

Reproduction URL

.

How to reproduce?

  1. Confirm electron preload.js is run for main window
  2. Open new window with vue router and target="_blank"
  3. Confirm electron preload.js is not run for the new window

Flavour

Quasar CLI with Webpack (@quasar/cli | @quasar/app-webpack)

Areas

Electron Mode

Platforms/Browsers

Chrome

Quasar info output

Operating System - Linux(5.13.0-27-generic) - linux/x64
NodeJs - 16.13.2

Global packages
  NPM - 8.1.2
  yarn - 1.22.17
  @quasar/cli - 1.3.2
  @quasar/icongenie - Not installed
  cordova - Not installed

Important local packages
  quasar - 2.7.7 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
  @quasar/app-webpack - 3.5.9 -- Quasar Framework App CLI with Webpack
  @quasar/extras - 1.15.2 -- Quasar Framework fonts, icons and animations
  eslint-plugin-quasar - Not installed
  vue - 3.2.38 -- The progressive JavaScript framework for building modern web UI.
  vue-router - 4.1.5
  pinia - 2.0.21 -- Intuitive, type safe and flexible Store for Vue
  vuex - Not installed
  electron - 20.1.1 -- Build cross platform desktop apps with JavaScript, HTML, and CSS
  electron-packager - Not installed
  electron-builder - Not installed
  @babel/core - 7.19.0 -- Babel compiler core.
  webpack - 5.74.0 -- Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
  webpack-dev-server - 4.9.3 -- Serves a webpack app. Updates the browser on changes.
  workbox-webpack-plugin - Not installed
  register-service-worker - 1.7.2 -- Script for registering service worker, with hooks
  typescript - 4.5.5 -- TypeScript is a language for application scale JavaScript development
  @capacitor/core - Not installed
  @capacitor/cli - Not installed
  @capacitor/android - Not installed
  @capacitor/ios - Not installed

Quasar App Extensions
  *None installed*

Relevant log output

No response

Additional context

No response

github-actions[bot] commented 2 years ago

Hi @jetacpp! 👋

It looks like you provided an invalid or unsupported reproduction URL. Do not use any service other than Codepen, jsFiddle, StackBlitz, Codesandbox, and GitHub. Make sure the URL you provided is correct and reachable. You can test it by visiting it in a private tab, another device, etc. Please edit your original post above and provide a valid reproduction URL as explained.

Without a proper reproduction, your issue will have to get closed.

Thank you for your collaboration. 👏

rstoenescu commented 2 years ago

Hi,

This has nothing to do with Quasar. You should check the Electron documentation on how to open a new window and have the preload script run/available. Closing this as its a ticket instead of a forum post.