quasarframework / quasar

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

Electron build error with Bun and pnpm because of package.json and lockfile mismatch #17085

Closed philfontaine closed 2 weeks ago

philfontaine commented 1 month ago

What happened?

When building for electron, a new package.json file is created and copied to the UnPackaged which only contains the dependencies, i.e. without the devDependencies.

The lockfile is also copied to that folder.

When running bun install or pnpm install, there will be a mismatch between the new package.json and the lockfile since the devDependencies are included in the lockfile, but are not found in the package.json.

image

This is my workaround:

      // This is a workaround. By default, the lock file is copied to the UnPackaged folder. However, the dev dependencies
      // are not copied to the package.json file. This creates a mismatch between the package.json and the lockfile,
      // resulting in an error.
      unPackagedInstallParams: ['install', '--prod', '--no-frozen-lockfile'],

Note: in PNPM it only fails in the CI since the --frozen-lockfile is only set by default if it detects a CI environment. In Bun, it also fails locally since --frozen-lockfile is set by default.

What did you expect to happen?

The workaround is implemented inside quasar so there are no build error by default.

Note: The workaround is not perfect, we indeed would normally want the lockfile to be frozen, especially in the CI. But it seems impossible because of the mismatch.

Reproduction URL

https://github.com/philfontaine/quasar-bug-electron-build-bun-pnpm

How to reproduce?

  1. Created a new quasar project
  2. Added electron mode
  3. Ran quasar build -m 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

No response

Relevant log output

No response

Additional context

No response

lizhongyue248 commented 2 weeks ago

Thank you, it has been very helpful to me

rstoenescu commented 2 weeks ago

Fix for Bun and PNPM will be available in: