-
-
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
Build not working with vite.config.ts and es-modules #537
Comments
Argh, I got bit by this. I recently needed to update my library to use npm run docs:build
> [email protected] docs:build
> vitepress build docs
vitepress v0.20.10
✓ building client + server bundles...
⠋ rendering pages...Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/roblevin/workspace/opensource/agnosticui/site/node_modules/agnostic-vue/dist/agnostic-vue.esm.js from /Users/roblevin/workspace/opensource/agnosticui/site/node_modules/vitepress/dist/client/app/temp/docs_components_alerts.md.js not supported.
Instead change the require of agnostic-vue.esm.js in /Users/roblevin/workspace/opensource/agnosticui/site/node_modules/vitepress/dist/client/app/temp/docs_components_alerts.md.js to a dynamic import() which is available in all CommonJS modules.
at Module.<anonymous> (/Users/roblevin/workspace/opensource/agnosticui/site/node_modules/vitepress/dist/client/app/temp/docs_components_alerts.md.js:5:19)
at /Users/roblevin/workspace/opensource/agnosticui/site/node_modules/vitepress/dist/client/app/temp/app.js:1368:12
at loadPage (/Users/roblevin/workspace/opensource/agnosticui/site/node_modules/vitepress/dist/client/app/temp/assets/Debug.0ad90550.js:140:18)
at Object.go (/Users/roblevin/workspace/opensource/agnosticui/site/node_modules/vitepress/dist/client/app/temp/assets/Debug.0ad90550.js:133:12)
at renderPage (/Users/roblevin/workspace/opensource/agnosticui/site/node_modules/vitepress/dist/node/serve-b109daa0.js:40037:10)
at Object.build (/Users/roblevin/workspace/opensource/agnosticui/site/node_modules/vitepress/dist/node/serve-b109daa0.js:40174:15) {
code: 'ERR_REQUIRE_ESM'
}
... I've got a good two dozen or so Vue examples e.g. Update: If you happen to have control enough to build the offending package as I do, you can remove the |
nani |
Describe the bug
My project is an es-modules-project (type="modules" in package.json). I run Node v16.1.0.
I added a
vite.config.ts
to my/docs
folder to include WindiCSS in my Vitepress project:I use the environment variable
--experimental-specifier-resolution=node
for running the scripts:docs:dev still works fine. But when I rund docs:build an error occurs:
If I rename the
vite.config.ts
tovite.config.js
it seems that the build process continues until the next error occurs:Reproduction
See above
Expected behavior
build should finish successfully
System Info
Additional context
The project runs under a yarn workspace monorepo
If I remove the vite.config.ts the build works fine.
Validations
The text was updated successfully, but these errors were encountered: