-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support vite 5 #85
Support vite 5 #85
Conversation
This is required as vite 5 uses Node16 resolved dependencies, Typescript can not use those without `moduleResolution: node16` but that will break a lot of other dependencies. So we need to go with module resolution bundler. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
…template Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #85 +/- ##
==========================================
- Coverage 81.69% 81.13% -0.57%
==========================================
Files 8 8
Lines 579 583 +4
Branches 48 48
==========================================
Hits 473 473
- Misses 58 62 +4
Partials 48 48 ☔ View full report in Codecov by Sentry. |
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.
Did I understand correctly that adding bundling with Vite here is needed, because this import
import type { PluginConfiguration as VitePluginInjectCSSOptions } from 'vite-plugin-css-injected-by-js/dist/esm/declarations/interface.d.ts'
is not allowed because it is not exported by package.json
?
We can grab this type as
type VitePluginInjectCSSOptions = Parameters<typeof injectCSSPlugin>[0]
(Or propose the lib author to export all the types)
No not only, the main problem is vite 5 importing |
But I would really appreciate any solution :) |
Why not |
I've just tried this type instead of import and build via type VitePluginInjectCSSOptions = Parameters<typeof injectCSSPlugin>[0] |
Because that does not work with Typescript ( |
Could you add more details on what doesn't work? It works for me, tested on building (After replacing invalid import) |
This is a bit more complex, the obvious changes:
But there are some other changes required to do so:
Needed to bundle the package as
tsc
will fail because vite 5 now uses some dependencies that use Node16 module resolution. Therefor we need moduleResolutionnode16
but this will fail due to a lot of dependency issues.So the only solution that worked for me was using
moduleResolution: Bundler
and using vite for bundling the package.This causes some test issues because now the local vite config would be used for testing, so I needed to adjust the tests a bit.