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

Quasar cannot find exported modules if using script setup, typescript and pug #16129

Closed
QozbroQqn opened this issue Jul 31, 2023 · 5 comments
Closed
Labels
area/cli area/typescript bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-vite kind/bug 🐞 Qv2 🔝 Quasar v2 issues

Comments

@QozbroQqn
Copy link

What happened?

Sidenote: Your Reporting an Issue | Contribution Guide is a 404

If using script setup, typescript and pug, quasar app fails to export interfaces/types:

image

I created the app with yarn create quasar:

  • quasar cli
  • typescript
  • sass
  • script setup
  • no eslint or others

and just changed:

  • package.json (added pug 3)
  • src/components/EssentialLink.vue
  • src/layouts/MainLayout.vue

It currently reports only the EssentialLinkProps but it also cannot find the interfaces exported in src/component/models.ts

What did you expect to happen?

It finds exported interfaces/types

Reproduction URL

https://stackblitz.com/edit/stackblitz-starters-vetrn3

How to reproduce?

  • cd into quasar-project
  • yarn
  • quasar dev
  • look into browser console

Flavour

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

Areas

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

Platforms/Browsers

No response

Quasar info output

Operating System - Linux(5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.1901.188) - linux/x64
NodeJs - 16.20.0

Global packages
  NPM - 9.4.2
  yarn - 1.22.19
  @quasar/cli - undefined
  @quasar/icongenie - Not installed
  cordova - Not installed

Important local packages
  quasar - 2.12.3 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
  @quasar/app-vite - 1.4.3 -- Quasar Framework App CLI with Vite
  @quasar/extras - 1.16.5 -- Quasar Framework fonts, icons and animations
  eslint-plugin-quasar - Not installed
  vue - 3.3.4 -- The progressive JavaScript framework for building modern web UI.
  vue-router - 4.2.4
  pinia - Not installed
  vuex - Not installed
  vite - 2.9.16 -- Native-ESM powered web dev build tool
  eslint - Not installed
  electron - Not installed
  electron-packager - Not installed
  electron-builder - Not installed
  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*

Networking
  Host - stackblitzstartersvetrn3-nlqe
  en0 - 192.168.1.104

Relevant log output

No response

Additional context

No response

@QozbroQqn QozbroQqn added kind/bug 🐞 Qv2 🔝 Quasar v2 issues labels Jul 31, 2023
@github-actions github-actions bot added area/cli area/typescript bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-vite labels Jul 31, 2023
@dongwa
Copy link
Contributor

dongwa commented Aug 21, 2023

No one, including the documentation, indicates that you can export variables or types from a .vue file. However, I have found some solutions to address this issue:

Using import type { EssentialLinkProps } from 'components/EssentialLink.vue';

image

Another way is that you can define your type in the 'src/components/models.ts' file.

In summary, there are numerous ways to address this matter, it shouldn't be considered an issue to Quasar.

@QozbroQqn
Copy link
Author

You are wrong. I ofcourse can export types and interfaces in .vue files and I do this for years now!
In fact Quasar does this too because the exports are coming from the yarn create quasar provided by Quasar.

As I wrote I did a yarn create quasar and added pug. Nothing else. If you do the same without pug, the errors are gone.

@rstoenescu
Copy link
Member

This is a Vue SFC issue, not Quasar.

@QozbroQqn
Copy link
Author

QozbroQqn commented Nov 6, 2023

This is a Vue SFC issue, not Quasar.

It's not. A Nuxt 3 minimal starter with pug works as expected even with SFC.

Edit:
Just tested a plain vue 3 with SFC and it does work with pug too

@QozbroQqn
Copy link
Author

Another strange thing (only in Quasar):
If I remove pug from and rebuild (npm/yarn run dev) the app. Everything is working fine. If I then add pug to again and wait until the HMR applies the changes, pug/quasar works as expected. After a rebuild (npm/yarn run dev) the errors reported in my first post are back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli area/typescript bug/1-repro-available A reproduction is available and needs to be confirmed. flavour/quasar-cli-vite kind/bug 🐞 Qv2 🔝 Quasar v2 issues
Projects
None yet
Development

No branches or pull requests

3 participants