-
Notifications
You must be signed in to change notification settings - Fork 57
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
Fix/typescript-config #248
Fix/typescript-config #248
Conversation
step 1: upgrade TS config |
Now that the TS config is compliant, we can - remove @ts-ignore overrides - import from "#imports" instead of importing from dependencies
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
step 2 : clean-up ts-ignore overrides and 'h3' imports in src/runtime |
step 3 : remove 'h3' imports from playground and fixtures |
- no need to import NitroAppPlugin from 'nitropack' - rename 'nitro' variable to 'nitroApp' for clarity
step 4 : use standard approach in nitro plugins |
step 5 : type runtimeConfig via nuxt/schema interface |
step 6 : this one improves how the lru-cache storage is mounted
Instead of inlining the config and mounting later in middleware, we explicitly mount it upfront via config in the nitro:config hook The warning is now suppressed |
Hey, I will make sure to merge it for 1.0.0-rc.2 :) |
I have included your latest fix for inlined implicit as it was blocking me from release. Thanks for that! I think after the release of 1.0.0-rc.1 you could just revert the last commit and we will be able to merge the rest of your stuff :) |
Update. Let's make it ready for the 1.0.0-rc.3. I needed to push a fix to 1.0.0-rc.1 because there was a bug that I didn't catch during testing. It was triggered once released to NPM :( |
Was the bug related to this PR? What is NPM complaining about? |
No no! the bug was releated to Nuxt internal. Basically, when I used the await import to import the vite plugin it was working perfectly until publishing a package to npm. After publishing and trying to install the package, it was breaking the app and showing error that the plugin is not a function. I changed the import from await to normal and it started working correctly. Pretty strange |
This reverts commit e751f52.
- conform eslint to standard recommendation - fix "template root requires one element" in secret.vue - also conforms 'npm run dev' script setup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few suggestions from my side
package.json
Outdated
"@nuxt/eslint-config": "^0.2.0", | ||
"@types/node": "^18.18.1", | ||
"eslint": "^8.50.0", | ||
"nuxt": "^3.7.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Nuxt recently released 3.8 version. Maybe we could migrate to that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.8 requires modification to type imports
See https://github.com/nuxt/nuxt/releases/tag/v3.8.0
Only minor modifications are required in our codebase, I will include these as well
@vejja could you please also resolve the conflict in 99-cspNonce file? It is probably caused by the other PR you created recently. |
will do |
Hey @vejja Could you please adjust this PR? I have merged your previous one about fixing complaine of CSP and it resulted in conflicts here. Also, could you try to fix the CI? Here is the output of Vercel: Thanks! 💚 |
Sure - Update: pls ignore, managed to reproduce on Vercel with standard setup |
Hi @Baroshem Update: pls ignore, the build was not failing because of this error, but because |
- add .nuxtrc autoImport directive in docs/ - enables building outside of root directory
Quick update:
Build-time warnings in the vercel logs are not on our side, but on third-party packages (nuxt-themes/docus). |
Thanks @vejja ! I will merge it to the 1.0.0-rc.3 branch and test it there. |
This PR aims at improving the TypeScript configuration of the repo
Types of changes
Description
Currently, the TypeScript linter emits several warnings throughout the codebase.
@ts-ignore
overridesdefineEventHandler
from 'h3') from modules dependencies, i.e. that are not directly defined in our package.jsonSolution: The Nuxt core team has formulated recommendations on how to setup the TS configuration of Nuxt modules (https://nuxt.com/docs/guide/going-further/modules).
This involves
1- setting the root tsconfig file to extend to
./.nuxt
instead of./playground/.nuxt
2- setting autoImports to false in
.nuxtrc
3- setting the playground tsconfig file to extend
./.nuxt
The configuration is detailed in the reference template for Nuxt3 modules at https://github.com/nuxt/starter/tree/module
In addition, we also need to provide complementary tsconfig files for the runtime/server and runtime/nitro folders, that extends
tsconfig.server.json
instead oftsconfig.json
.This is directly copied from the reference template for Nuxt3 apps at https://github.com/nuxt/starter/tree/v3
We further add a specific
.nuxtrc
file in the playground that allows autoImports in this folder only. This allows us to use classic Nuxt syntax (auto-imports) in the playground. This setup is replicated in fixture files for tests to run without modification.Finally, the content of package.json is also upgraded to follow the Nuxt recommendations, specifically with regards to the
npm run dev:prepare
script, and to npm package versions.Checklist:
No changes are required to the documentation and the tests pass.
In order for the types to be correctly re-generated, it is required to run