-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Better support for type: "module"
from user
#917
Comments
Can you try with the |
I don't think so? https://github.com/vuejs/vitepress/blob/chore/vite-3/src/node/index.ts For example, no |
That file is processed by Rollup which adds the extensions. In |
I also encountered this problem when I run |
Actually, I had tried applying |
|
I meant in VitePress' tsconfig (to resolve this issue). |
Oh, right, thanks for fixing this issue. |
I tried but I'm still not able to fix this because of some issue with |
Is |
Yeah, |
OK, I'll add it locally and manually. |
Okay, so now there is another issue. VitePress is unable to resolve custom theme if its in TS (and user has not added moduleResolution: nodenext to their tsconfig.json) :/ |
I'm not sure why? Can it be tested easily? |
git clone https://github.com/vuejs/vitepress -b chore/vite-3
cd vitepress
pnpm i && pnpm build && pnpm pack
cd ..
mkdir foo
cd foo
pnpm add -D ../vitepress/vitepress-1.0.0-alpha.4.tgz vue typescript
mkdir .vitepress
mkdir .vitepress/theme
echo "export { default } from 'vitepress/theme'" >.vitepress/theme/index.ts
echo "# Hello VitePress" > index.md
pnpm vitepress build |
Probably has something to with our aliases. |
Thanks, I'll take a look tonight. |
Any progress on the issue? It's currently blocking me from setting up CI/CD pipeline |
Sorry, no time again. |
Is your feature request related to a problem? Please describe.
The outputs ESM entries are not fully compatible with native ESM actually, take the following as example
https://unpkg.com/browse/[email protected]/dist/client/index.js
All relative file paths should be ended with correct
.js
extension, and/index.js
can not be omitted anymore.That's being said, we should use
moduleResolution: "Node16"
instead.And when the user enables
type: "module"
in theirpackage.json
or.vitepress/package.json
, all temporary.js
files in.vitepress/.temp
would be considered as ESM only, and now it would emit error:Describe the solution you'd like
Enable
moduleResolution: "Node16"
and add apackage.json
into.vitepress/.temp
withtype: "commonjs"
for now, and migrate all outputs files as pure ESM later.Describe alternatives you've considered
We can use
.cjs
files extensions for files outputs in.vitepress/.temp
Additional context
Reference https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#package-json-exports-imports-and-self-referencing
Validations
The text was updated successfully, but these errors were encountered: