quasarframework / quasar

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

Build mode --electron in pnpm monorepo #14436

Open ghost opened 2 years ago

ghost commented 2 years ago

What happened?

When I run quasar build and its will failed with error message(I set dist dir in project root/dist) There is package

/@quasar/app-vite/lib/modes/electron/electron-builder.js:128
          ? bundler({
            ^

TypeError: bundler is not a function

Try electron-package or electron-builder both failed

And there is builder

: bundler.build(bundlerConfig)
                    ^

TypeError: Cannot read properties of undefined (reading 'build')

starting build to dist/Unpackage in pnpm monorepo,it will remove my devDependencies in quasar project

What did you expect to happen?

build successful

Reproduction URL

https://github.com/DaiYuANg/Vinculum/tree/main/core/frontend

How to reproduce?

Clone my git repository and pnpm i && cd core/frontend && pnpm build:electron

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

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

Platforms/Browsers

Electron

Quasar info output

Operating System - Darwin(21.6.0) - darwin/arm64
NodeJs - 16.17.0

Global packages
  NPM - 8.19.2
  yarn - 1.22.19
  @quasar/cli - 1.3.2
  @quasar/icongenie - Not installed
  cordova - Not installed

Important local packages
  quasar - 2.8.3 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
  @quasar/app-vite - 1.1.1 -- 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 - Not installed
  eslint - 8.22.0 -- An AST-based pattern checker for JavaScript.
  electron - 19.0.17 -- Build cross platform desktop apps with JavaScript, HTML, and CSS
  electron-packager - 15.5.2 -- Customize and package your Electron app with OS-specific bundles (.app, .exe, etc.) via JS or CLI
  electron-builder - 22.14.13 -- A complete solution to package and build a ready for distribution Electron app for MacOS, Windows and Linux with “auto update” support out of the box
  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*

Relevant log output

: bundler.build(bundlerConfig)
                    ^

TypeError: Cannot read properties of undefined (reading 'build')

Additional context

In pnpm workspace(monorepo)

ghost commented 2 years ago

I test without workspace and using yarn, its successful. so quasar not support pnpm yet?

dongwa commented 2 years ago

I test without workspace and using yarn, its successful. so quasar not support pnpm yet?

I met the same problem, can you solve it. I found the quasar currently supported PNPM at the experimental stage, it could be a bug

ghost commented 2 years ago

The bug is inside quasar CLI, I did not solve it, I make ppm workspace ignore quasar project and use yarn in quasar project, or you can switch to lerna and yarn for monorepo.

ldiebold commented 1 year ago

This might be because quasar-cli is trying to use yarn when setting up a new electron app. If there is no src-electron folder, it uses yarn to prepare the app for using electron.

I was able to solve this by:

  1. removing node_modules
  2. yarn install
  3. yarn quasar dev -m electron (run the local version of quasar-cli using yarn)
  4. We should now have a src-electron folder. This means quasar won't try to "set things up" next time we run our electron app
  5. remove yarn.lock and node_modules
  6. pnpm install
  7. pnpm quasar dev -m electron

Try those steps as a workaround. It's a "best case" workaround because once setup, you'll no longer have this problem with yarn trying to run when using electron.

We'll need a longer term solution though!

EugenGedroyc commented 1 year ago

In my case "quasar dev -m electron" works fine out of the box but when i use "quasar build -m electron" i get an error in console I didn't save complete error message but main is "links out of the package":

 App •  WAIT  • Bundling app with electron-packager...
Packaging app for platform win32 x64 using electron v25.3.0
 App • ⚠️   electron-packager could not build

Error: C:\Users\EGIEDR~1\AppData\Local\Temp\electron-package file "..\..\..\..\..\..\..\..\..\..\work\lkhp\lkhp-dashboard links out of the package

node:internal/process/promises:288
            ^
ERR_UNHANDLED_REJECTION

[UnhandledPromiseRejection: This error originated either by ot handled with .catch(). The promise rejected with the reas
}

With Yarn works fine

I guess @ldiebold's solution won't help me for the production version