Closed seiberspace closed 5 months ago
Hi,
I have run Quasar in your project folder. I get no errors since the line you indicated gets compiled correctly:
Upon a deep inspection, it seems that when NPM is used as a package manager, it messes up the dependencies and badly influences the compilation.
Can you try using Yarn v1 instead, please? (it's what I am using and it works correctly) Until I can figure out what NPM does wrong. Thanks.
Hi Razvan,
Thank you for your reply, that's interesting... I can't be sure (yet) if all my globally installed packages are in order, I'm not really taking care of my Windows installation. So if you say it works for you, let's assume the problem is on my side. I will still have a look, maybe reinstall all global packages.
However, I meanwhile switched for this project to vite, took it as a nudge to finally do that. And that works as a charm!
So if you agree that the problem is likely related to my installation, then I'm fine if we close this issue.
Thanks and keep up the great work - If you need a testimonial, here is mine: Quasar is the first framework I ever used that gave me both working out-of-the-box components and the flexibility to create my own without hassle. Since many years my UI-framework of choice.
Cheers, Arne
Same problem here
Error
.quasar/electron/electron-preload.js
/***/ "electron":
/*!***************************!*\
!*** external "electron" ***!
\***************************/
/***/ ((module) => {
"use strict";
module.exports = require("electron");
/***/ }),
/***/ "@electron/remote":
/*!***********************************!*\
!*** external "@electron/remote" ***!
\***********************************/
/***/ ((module) => {
"use strict";
module.exports = @electron/remote;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
...
quasar info:
Important local packages
quasar - 2.14.2 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
@quasar/app-webpack - 3.12.1 -- Quasar Framework App CLI with Webpack
Very similar to this question: https://github.com/quasarframework/quasar/issues/16497
But this time is
module.exports = @electron/remote;
And unfortunately for my project the v3.12.1 fix still doesn't solve the problem.
So I started to follow v3.11.1 and compare the commits of later versions and found that The following change is what caused the error for my project https://github.com/quasarframework/quasar/commit/b4ce74000eecddd28cbaef956181ab5437e478be
Now I use the latest version from current npm (v3.12.1),
Then add .libraryTarget('commonjs2')
back and my project will work normally.
hope developers can help eradicate this problem.
Should be fixed with the new CLIs (release major new versions today). Please take a look and comment if this still doesn't works.
What happened?
When running
quasar dev -m electron
and having someimport
statement in the preload script atsrc-electron/electron-preload.js
, the electron console shows an error about the preload script.quasar/electron/electron-preload.js
. The error can vary depending on theimport
statement.Reason is a mutilated
require
statement for eachimport
:where the last line should be:
This leads to a
ReferenceError
for normal packages, and a syntax error for scoped packages.What did you expect to happen?
No error is shown, the file is
require
d.Reproduction URL
https://stackblitz.com/edit/quasarframework-webpack-pfqfgw?file=src-electron%2Felectron-preload.js
How to reproduce?
Not sure if the reproduction link makes any sense for an electron app, anyway:
import { contextBridge } from 'electron';
quasar dev -m electron
.quasar/electron/electron-preload.js
. There will be the mutilatedrequire
statement.Flavour
Quasar CLI with Webpack (@quasar/cli | @quasar/app-webpack)
Areas
Electron Mode
Platforms/Browsers
Electron
Quasar info output
Relevant log output
No response
Additional context
No response