-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Moving VitePress' Node API as ESM only #2703
Comments
I think this kind of plan works. |
I sent PRs to a half dozen of these and filed issues with a handful more.
This might end up causing multiple warnings if Vite decides to go the route of logging warnings. Honestly, it's probably easier to just go ahead and drop the CJS API now, so that you don't have to do a followup PR. I've either fixed or notified the affected projects and the error message will be a pretty common one since lots of projects are doing this migration, so there will be plenty of info out there on how to fix it. |
An update from vitejs/vite#13928 - we have PRs out now to migrate all projects to ESM except for Vitepress and Storybook |
* chore(deps-dev): bump vitepress from 1.0.0-beta.7 to 1.0.0-rc.4 Bumps [vitepress](https://github.com/vuejs/vitepress) from 1.0.0-beta.7 to 1.0.0-rc.4. - [Release notes](https://github.com/vuejs/vitepress/releases) - [Changelog](https://github.com/vuejs/vitepress/blob/main/CHANGELOG.md) - [Commits](vuejs/vitepress@v1.0.0-beta.7...v1.0.0-rc.4) --- updated-dependencies: - dependency-name: vitepress dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * fix: change node version to 18 * fix: vuejs/vitepress#2703 * fix: update name * fix: update color scheme --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Schoch, Kevin <kevin.schoch@sybit.de>
Updating vitepress required specifying the package type to module, see vuejs/vitepress#2703
Vite might be removing/deprecating it's CJS API is near future (vitejs/vite#13928) which will impact VitePress' CJS API as well.
Edit: Let's wait on discussion at Vite's side to conclude and we will try to follow their footsteps. But, it is recommended to use ESM APIs for anything new you might be building.
Most of the projects already appear to be using the import syntax. A quick GitHub code search shows about 20 public projects doingrequire('vitepress')
. Exploring more, over half of them appear to be onvitepress@0.x
branch. Leaving less than 10 projects that might need minor refactoring.import
syntax inconfig.js
file when"type": "module"
is not specified in nearest package.json also uses the CJS build. Might be difficult to estimate the impact. But for most of the cases where people are using import without type module or mjs/mts extension the migration should be straight forward -- either change the file extension or project level type.Migration:
For maintainers, we will need to use jiti for the CLI and remove CJS stuff from rollup config.CLI won't need any changes, it's already CJS compatible and uses ESM output. Only rollup related changes need to be done.
Rollout plan:
Let's log a warning for now if someone
require
's the package. We can drop the CJS API by RC./cc @kiaking @zonemeen
The text was updated successfully, but these errors were encountered: