-
Notifications
You must be signed in to change notification settings - Fork 25
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
The requested module moment does not provide an export named default #33
The requested module moment does not provide an export named default #33
Comments
I have created minimal reproduction here: https://stackblitz.com/edit/github-zbjrsg-zc4yzq?file=package.json thanks 🙏😊 |
@luckylooke try to use |
@towerhe - this does indeed help, thanx. |
It should work in the last version. |
And it only throw erros in dev. |
While not ideal, I managed to work around this issue by adding a optimizeDeps: { include: ['moment-mini', '@braintree/sanitize-url'] } as apparently, the CommonJS detection did not work correctly for those dependencies. |
Hi! I get the same issue with module
Does someone knows a workaround? |
Ok, setting |
Slightly different error in console When I check to see the source of the problem it is dayjs in the latest version of mermaid |
the solution above should work for vitepress v10.0.0 as long as your chart don't use dates.. the final solution should wait for the dayjs 2.0 to have an official release.. see mermaid-js/mermaid#4153 (comment) |
Another change I made that should fix this.. |
For those wondering how to make it work for a fresh install: The required changes are:
In .vitepress/config.ts import { defineConfig } from 'vitepress'
import { withMermaid } from "vitepress-plugin-mermaid";
export default withMermaid(
defineConfig({
vite: {
optimizeDeps: { include: ['@braintree/sanitize-url'] },
resolve: {
alias: {
dayjs: 'dayjs/',
},
},
},
... In package.json "@mermaid-js/mermaid-mindmap": "^9.3.0",
"mermaid": "^8.14.0", With the previous modifications I could have both dev and build targets |
It still is not working, and I see that PR was reverted by the mermaid team on June 1. At the same time, I see in the last commits that the plugin updated deps on mermaid 10. Any ideas on how to make it work? I don't have charts with dates but I can't build my docs with error: "dayjs/dayjs.min.js?v=8dd7652e' does not provide an export named 'default' " |
@dspinov It should be working.. but I just discovered it is not pnpm compatible.. |
Hi @emersonbottero. You are right. I've tested with npm and all is good. This is interesting. I didn't find any related issues about that. I see that dayjs team has mentioned a solution for the same problem by using esModuleInterop in TS. But I don't have TS on the project. Do you know maybe how to do the same with vitejs only? |
I added all necessary settings on the package, you can try pnpm install --shamefully-hoist . What make it to work was this changes |
There is a new issue when using 'pnpm install --shamefully-hoist' with the 'mermaid' module.
"mermaid": "10.5.0",
"vitepress": "1.0.0-rc.20",
"vitepress-plugin-mermaid": "2.0.15" I'm uncertain about the solution to this problem. Could you please provide some suggestions? thanks💕 |
Hi,
after installation into my project I am getting error in browser console, running vitepress docs:
I have already tried to setup my tsconfig.json, adding
but didn't fixed... any idea what to try?
Many thanks 🙏
The text was updated successfully, but these errors were encountered: