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
Deprecation messages in Vite 5 #134
Comments
any plan to publish to npmjs.com ? |
什么时候更新啊 |
Try vite-plugin-simple-html. |
I just tried |
The issue is solved for me now when adding A future implementation might even be able to read the installed version of Vite and behave accordingly without the need for an explicit option (especially since future breaking changes in Vite 6+ may require an additional option |
I tired to do this, but couldn't find a good way to get the version number of the vite currentily used by the external project(Maybe there are some ways to do it and I just didn't find it ). |
At least the latest version of Vite appears to export its There are some other ways to do this using Vite’s
|
When |
|
But we can catch this. How about async function getViteMajorVersion() {
try {
let { version } = await import("vite");
return Number(version.split(".")[0]);
} catch (_) {
return 2;
}
} |
Yeah! I just thought of that too, I'm coding now. |
There is a new question, do I need to keep the |
@ryomahan I believe we can remove it. Even in the future, we should be able to adapt to the different behavior of major Vite versions using the function I proposed. Also, for users it is difficult to understand which versions of Vite are |
My concern is whether this will affect people who have already upgraded vite-plugin-html. |
There should be no troubles in JavaScript, additional entries in the user options object are probably ignored. For TypeScript, we could keep the option in
/**
* fit vite2+
*
* @deprecated This option is no longer needed and can be safely removed from your configuration, as
* the plugin will automatically detect the version of Vite from now. This option will
* be removed in the next major version.
*/
viteNext?: boolean; But I am also fine with removing it entirely, the very few users of this option (which has been published for a very short time) are probably also reading this discussion. |
Ok, I'll submit the PR after verifying that the code is ok. |
Another tricky question, the createPlugin method is not async... |
I made it Edit: It accepts import { … } from "vite"; to import vite from "vite"; or import * as vite from "vite"; and check whether |
That's a good idea, I've spent a lot of time on how to handle asynchronous results. |
finish it in #140 |
/** |
After upgrading to Vite 5, I see the following warning messages when starting the Vite server or building with Vite:
The text was updated successfully, but these errors were encountered: