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

Since updating to Quasar 2.16.0 functions returning the any type. #17172

Closed
rstoenescu opened this issue May 7, 2024 Discussed in #17170 · 21 comments
Closed

Since updating to Quasar 2.16.0 functions returning the any type. #17172

rstoenescu opened this issue May 7, 2024 Discussed in #17170 · 21 comments

Comments

@rstoenescu
Copy link
Member

Discussed in #17170

Originally posted by MartinX3 May 6, 2024
I updated to Quasar 2.16.0 and @quasar/app-vite 2.0.0-beta.12.
Now eslint errors out because as example this variable has now the type any.

import { date, } from 'quasar'
const daysInMonth = date.daysInMonth(new Date())

I look at the code in my IDE and also hover over the function.
It says the return type is number.
But eslint says any.
Adding the variable type via my IDE also puts the any at it.

And updating app-vite to beta 12 errors out with

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/home/runner/work/[...]/node_modules/quasar/wrappers' is not supported resolving ES modules imported from /home/runner/work/[...]/quasar.config.ts.temporary.compiled.1715059034987.mjs
Did you mean to import "quasar/wrappers/index.js"?
```</div>
@rstoenescu
Copy link
Member Author

Fixed in Quasar v2.16.1

@rstoenescu
Copy link
Member Author

@MartinX3 and @UkonnRa pls try with v2.16.1
Also, make sure that you restart your IDE to eliminate any sync issues.

@UkonnRa
Copy link

UkonnRa commented May 7, 2024

Impressive! Everything works as expected in 2.16.1! Thanks for your quick support!!!

@MartinX3
Copy link

MartinX3 commented May 7, 2024

@rstoenescu
Thank you.
quasar dev is fixed but quasar build is (now) broken.

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/runner/work/[...]/[...]/node_modules/.pnpm/@quasar+vite-plugin@1.6.0_@vitejs+plugin-vue@5.0.4_vite@5.2.10_@types+node@20.12.10_sass@1.75_fxwfyg26cdo6pyzenxcq254jcq/node_modules/quasar/dist/transforms/import-transformation.js' imported from /home/runner/work/[...]/[...]/node_modules/.pnpm/@quasar+vite-plugin@1.6.0_@vitejs+plugin-vue@5.0.4_vite@5.2.10_@types+node@20.12.10_sass@1.75_fxwfyg26cdo6pyzenxcq254jcq/node_modules/@quasar/vite-plugin/src/vue-transform.js
    at finalizeResolution (node:internal/modules/esm/resolve:265:11)
    at moduleResolve (node:internal/modules/esm/resolve:933:10)
    at defaultResolve (node:internal/modules/esm/resolve:1157:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:390:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:359:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:2[34](https://github.com/[...]]/[...]/actions/runs/8982482311/job/24670183936#step:7:35):38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:87:39)
    at link (node:internal/modules/esm/module_job:86:[36](https://github.com/[...]/[...]/actions/runs/[...]/job/[...]#step:7:37)) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///home/runner/work/[...]/[...]/node_modules/.pnpm/@quasar+vite-plugin@1.6.0_@vitejs+plugin-vue@5.0.4_vite@5.2.10_@types+node@20.12.10_sass@1.75_fxwfyg26cdo6pyzenxcq254jcq/node_modules/quasar/dist/transforms/import-transformation.js'
}

@rstoenescu
Copy link
Member Author

Reinstall from scratch pls. Seems like it's already got the old version of q/vite-plugin and not checking for the newer one.

@MartinX3
Copy link

MartinX3 commented May 7, 2024

I already removed the node_modules and my pnpm-lock-yaml.
And also my github CI has this problem, too, which doesn't cache the node_modules.
I use 2.16.1 and app-vite beta 12.

@cirolosapio
Copy link
Contributor

I can confirm that the issue is resolved by testing it with both the dev and build commands

@MartinX3
Copy link

MartinX3 commented May 7, 2024

This is weird.
I removed the node_modules and pnpm-lock-yaml a second time in this 5 minutes and now @quasar/app-vite@2.0.0-beta.12 added the '@quasar/vite-plugin': 1.7.0 dependency.
Black magic or so.
It works now.

@rstoenescu
Copy link
Member Author

I'll enforce q/app-vite beta to install the newer q/vite-plugin (though it should by default). But working on improving some other stuff before making a new release.

@rstoenescu
Copy link
Member Author

Thanks everyone for your feedback!

@MartinX3
Copy link

MartinX3 commented May 7, 2024

@rstoenescu
Thank you.
By the way speaking about modules.
Why is quasar using moduleResolution: node with module: esnext in the tsconfig?
According to https://www.typescriptlang.org/tsconfig/#moduleResolution the node value is a deprecated value which got renamed to node10.
The newer ones are node16 / nodenext and the compatibility value bundler.
(module also got the newer value node16 / nodenext)

Node 10 is EOL since 2021-04-01 and Node 16 since 2023-09-11.

Since quasar 2.16 got its package internal build system to ESM it might be useful to refactor the tsconfig-preset in app-vite.

@rstoenescu
Copy link
Member Author

@yusufkandemir pls check the above comment from Martin

@MartinX3
Copy link

MartinX3 commented May 7, 2024

Thank you.
I remember now I did mark him in march, too.
#9455 (comment)

@panmenghan
Copy link

@rstoenescu
v2.16.1 still have a problem: not able to import useQuasar and QuasarPluginOptions

image

@rstoenescu
Copy link
Member Author

@panmenghan can u show me the output of quasar info pls?

@rstoenescu
Copy link
Member Author

And a reproduction repo would be nice

@panmenghan
Copy link

@rstoenescu
https://github.com/panmenghan/quasar-bug

Install with pnpm i

Open index.ts with vscode, and the error will show

@rstoenescu
Copy link
Member Author

@panmenghan
Seems an issue with your tsconfig.json. Changing the following works:

"module": "esnext",
"moduleResolution": "node",

@MartinX3
Copy link

MartinX3 commented May 7, 2024

Better to use

"moduleResolution": "Bundler",
"verbatimModuleSyntax": true

node alias node10 is really outdated.
The modern moduleResolution are node16 nodenext bundler

In my case I also use the modern "type": "module", in my package.json and

"module": "esnext",
"moduleResolution": "node",

leads to as example Cannot find module '@yeger/vue-masonry-wall' or its corresponding type declarations. with the vue-tsc checker.
bundle as above fixed it for me.

@panmenghan
Copy link

@MartinX3 @rstoenescu
Thanks.

Change the value of moduleResolution to Bundler or node both works.

But if quasar support all the moduleResolution mode would be better.

The node16 mode require all the relative import(dist/types/*.d.ts) explicitly add .js extension and imported folder with /index.js suffix. But if the Bundler or node mode, the .js or ./index.js can be omited.

@rstoenescu
Copy link
Member Author

We'll improve this in the near future. Right now I just wanted to give a hint on where the problem is coming from. Did not mean that module + moduleResolution should only have that values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants