Closed Fachep closed 2 months ago
Add ts-ignore for now. It will be fixed when we update deps here.
Is there any reason why VitePress is currently bundling @types/markdown-it
in dist/node/index.d.ts
?
$ grep "interface MarkdownIt" node_modules/vitepress/dist/node/index.d.ts
1250:interface MarkdownItConstructor {
1259:interface MarkdownIt {
1712: interface MarkdownItEnv {
1731:interface MarkdownItHeader {
1794: interface MarkdownItEnv {
1868: interface MarkdownItEnv {
This problem will keep happening on every future @types/markdown-it
version. It would be nice to just extern this dependency so even if VitePress and plugins use different versions, we can use our package manager to override the resolved version.
It seems VitePress is currently using rollup-plugin-dts
to bundle type definitions and using respectExternal
option
However, I don't think this option actually externs dependencies:
I think it's treating the case where respectExternal === true
and resolvedModule.isExternalLibraryImport === true
same as non-external dependency
I was able to remove @types/markdown-it
from the bundle by editing VitePress's rollup.config.ts
:
const dtsNode = dts({
// respectExternal: true,
tsconfig: r('src/node/tsconfig.json')
})
// const originalResolveId = dtsNode.resolveId
// dtsNode.resolveId = async function (source, importer) {
// const res = await (originalResolveId as Function).call(this, source, importer)
// if (res?.id) res.id = await fs.realpath(res.id)
// return res
// }
I have to comment out the resolveId
function because it's causing a bunch of ENOENT
errors. However I'm not sure what the implications are for removing the modified resolveId
function
This problem hasn't been fixed yet, right?
just released in 1.3.3
Describe the bug
DefinitelyTyped/DefinitelyTyped#70083 changed type
Delimiter
. Now npm resolves"@types/markdown-it": "^14.1.1"
to 14.1.2, which does not match the type definition exported from vitepress. Adding plugins for MarkdownIt causes tsc error TS2769: No overload matches this call.Reproduction
package.json:
https://stackblitz.com/edit/vite-qlr8wt?file=tsc.out.log Run
npx tsc
at package root.Expected behavior
No errors from tsc.
System Info
I guess vitepress shouldn't embed external type definitions like this?
Validations