Replies: 1 comment
-
Can you please make a reproduction — it is likely that the code you have is problematic |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys, I've found a weird bug after compiling unified along with remarks plugins in my Vue 3 + Vite project. I hope somebody who faces the same issue can find this post and maybe a permanent fix can be put in-place. This error doesn't seems to show when I was running in dev preview without building the app, can only happens after I build it for deployment on CDN.
This is the error that I am getting after digging the build JS file:
TypeError: done is not a function
Or actually the error as following when the project was minified after build:
TypeError: t is not a function
With some more digging, I realized there are some compile error when handling the code in Unified:
Here is the original code
unified/lib/index.js
Lines 707 to 770 in 6838c70
My assumption is that the line
assert(done, 'done is defined if resolve is not')
is being ignored after compiling, hence when done is undefined, thedone()
function still being called and results in error.My current workaround is by changing
async unified.process()
tounified.processSync()
as it does not take in the optional callback function to be called at the end, hence avoiding the problem completely.As for long terms fix, I assume adding a if statement to check if
done()
is a function can fix the problem. However, it could be an issue with the compiler or compiler options that has nothing to do with unified.Hope someone with more knowledge can enlighten me on this issue, thanks!
Beta Was this translation helpful? Give feedback.
All reactions