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 Quasar Plugin - Dev Server Bootstrapping issue #15815

Open
ChronosMasterOfAllTime opened this issue May 10, 2023 · 8 comments
Open

Vite Quasar Plugin - Dev Server Bootstrapping issue #15815

ChronosMasterOfAllTime opened this issue May 10, 2023 · 8 comments
Labels
area/plugins 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

@ChronosMasterOfAllTime
Copy link

ChronosMasterOfAllTime commented May 10, 2023

What happened?

Hello, using the quasar vite plugin v1.3.3 I am getting the following error when the ESM bundles are being created:

chunk-XGACGZPK.js?v=56f045f9:1230 Uncaught TypeError: RefImpl is not a constructor
    at createRef (chunk-XGACGZPK.js?v=56f045f9:1230:10)
    at ref (chunk-XGACGZPK.js?v=56f045f9:1221:10)
    at chunk-E7NZVENM.js?v=56f045f9:49:32

I have tried removing the split chunks plugin and going barebones. This seems to be an odd issue with Vite 4.x and Quasar. I can get the dev server to run by commenting out the quasar plugin, but that defeats the purpose of using it. I also had to remove this for Vitest to work correctly.

What did you expect to happen?

The Dev Server bootstraps correctly and starts without failure.

Reproduction URL

https://stackblitz.com/edit/quasarframework-jflmsk

How to reproduce?

  1. Go to the repro link
  2. Wait for the dev server page to load
  3. open dev tools
  4. See error "RefImpl is not a constructor" in the console

Flavour

Vite Plugin (@quasar/vite-plugin)

Areas

Plugins (quasar)

Platforms/Browsers

Firefox, Chrome, Safari, Microsoft Edge, Electron

Quasar info output

N/A - not using Quasar CLI

Relevant log output

chunk-XGACGZPK.js?v=56f045f9:1230 Uncaught TypeError: RefImpl is not a constructor
    at createRef (chunk-XGACGZPK.js?v=56f045f9:1230:10)
    at ref (chunk-XGACGZPK.js?v=56f045f9:1221:10)
    at chunk-E7NZVENM.js?v=56f045f9:49:32

Additional context

This is also an issue with Vitest. Removing the plugin from the vite configuration allows the tests to run.

It seems this is the line in question that's failing:

export const isRuntimeSsrPreHydration = __QUASAR_SSR_SERVER__
  ? { value: true }
  : ref(
    __QUASAR_SSR_CLIENT__ && (
      __QUASAR_SSR_PWA__ ? document.body.getAttribute('data-server-rendered') !== null : true
    )
  )
@github-actions github-actions bot added area/plugins bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/vite-plugin Bugs related to Vite usage with Quasar labels May 10, 2023
@ChronosMasterOfAllTime
Copy link
Author

Any updates on this?

@jacksongross
Copy link

Can confirm this is affecting our apps as well when testing with vitest. Any update on a fix for this?

@raymondmuller
Copy link

+1

1 similar comment
@AdamDrewsTR
Copy link

+1

@david-mohr
Copy link

I'm seeing the same error with cypress component tests

@david-mohr
Copy link

david-mohr commented Jun 19, 2023

After some testing, it appears that import order matters. vue MUST be imported before anything else. In the linked code, if you open src/main.ts and move the following line to the top of the file, it starts working:

import { createApp } from 'vue';

Same fix works for cypress component testing, adding import 'vue' to the top of test/cypress/support/component.js gets the tests working again.

@jacksongross
Copy link

After some testing, it appears that import order matters. vue MUST be imported before anything else. In the linked code, if you open src/main.ts and move the following line to the top of the file, it starts working:

import { createApp } from 'vue';

Same fix works for cypress component testing, adding import 'vue' to the top of test/cypress/support/component.js gets the tests working again.

Can confirm adding import 'vue' to the top of test/cypress/support/component.js makes all my tests work again. Must be some weird import ordering behaviour indeed. Would be great to fix this if possible.

@ChronosMasterOfAllTime
Copy link
Author

After some testing, it appears that import order matters. vue MUST be imported before anything else. In the linked code, if you open src/main.ts and move the following line to the top of the file, it starts working:

import { createApp } from 'vue';

Same fix works for cypress component testing, adding import 'vue' to the top of test/cypress/support/component.js gets the tests working again.

Can confirm adding import 'vue' to the top of test/cypress/support/component.js makes all my tests work again. Must be some weird import ordering behaviour indeed. Would be great to fix this if possible.

Import order was never an issue before. What changed? I would consider this a hack to fix the issue, when it should be reconciled by the transpiler and/or the plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugins 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

5 participants