Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vite-plugin incorrectly relies on vite mode #17267

Closed
yurks opened this issue Jun 9, 2024 · 3 comments
Closed

vite-plugin incorrectly relies on vite mode #17267

yurks opened this issue Jun 9, 2024 · 3 comments
Labels
area/cli bug/1-hard-to-reproduce A reproduction is available, but it's hard to reproduce, so it has a lower priority. bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/vite-plugin Bugs related to Vite usage with Quasar kind/bug 🐞 Qv2 🔝 Quasar v2 issues

Comments

@yurks
Copy link

yurks commented Jun 9, 2024

What happened?

vite build --mode qa (or any other mode except 'production') produces a bundle with development import of quasar.

image

What did you expect to happen?

Only vite command is used for development and running vite build command should produce production bundle for any mode:

image

Reproduction URL

https://github.com/yurks/quasar-vite-issue

How to reproduce?

  1. fork provided repo
  2. run yarn build to check correct production build
  3. run yarn build:qa to check incorrect production qa build

Flavour

Vite Plugin (@quasar/vite-plugin)

Areas

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

Platforms/Browsers

No response

Quasar info output

No response

Relevant log output

No response

Additional context

Vite modes is a bit tricky and it's not always obvious that production mode is not the same with NODE_ENV=production. That means we can run vite build with different modes, but suppose to have production build as a result.

Quasars vite-plugin relies on vite mode here and here which makes impossible to have production build with vite build --mode qa, for example. It would be more correct to rely on build value of vite env config command property.

@yurks yurks added kind/bug 🐞 Qv2 🔝 Quasar v2 issues labels Jun 9, 2024
@github-actions github-actions bot added area/cli bug/1-hard-to-reproduce A reproduction is available, but it's hard to reproduce, so it has a lower priority. bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/vite-plugin Bugs related to Vite usage with Quasar labels Jun 9, 2024
@rstoenescu
Copy link
Member

Hi,

Vite command viteConf.command viteConf.mode
serve serve development
build build production
preview serve production

If not relying on "mode" then the "vite preview" command will confuse our plugin and produce a hybrid compilation (dev + prod parts combined).

@yurks
Copy link
Author

yurks commented Aug 16, 2024

@rstoenescu is this fixed somewhere?

// just commented in #17272

@rstoenescu
Copy link
Member

Let's continue conversation on the PR. I have just noticed the comment there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli bug/1-hard-to-reproduce A reproduction is available, but it's hard to reproduce, so it has a lower priority. bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/vite-plugin Bugs related to Vite usage with Quasar kind/bug 🐞 Qv2 🔝 Quasar v2 issues
Projects
None yet
Development

No branches or pull requests

2 participants