webcontainer-core
webcontainer-core copied to clipboard
StackBlitz does not print correct error message? Unexpected identifier '𝐬𝐛_𝐞𝐱𝐩𝐨𝐬𝐞'
Description of Bug
Trying to build a docusaurus site with errors leads the error message being printed badly.
Note: we use TC39 Error cause, this might be the reason?
Steps to Reproduce
Go to https://stackblitz.com/edit/github-ikeyac?file=docs%2Ftutorial-basics%2Fmarkdown-features.mdx
Run yarn build
See weird error message displayed in StackBlitz:
Expected Behavior
The correct error message when running outside StackBlitz:
[INFO] [en] Creating an optimized production build...
✔ Client
✔ Server
Compiled successfully in 7.72s
● Client █████████████████████████ cache (99%) shutdown IdleFileCachePlugin
stored
● Server █████████████████████████ cache (99%) shutdown IdleFileCachePlugin
serialize pack
Error: Unable to build website for locale en.
at tryToBuildLocale (/Users/sebastienlorber/Desktop/docusaurus-reproductible-broken-link/node_modules/@docusaurus/core/lib/commands/build.js:55:19)
at async mapAsyncSequential (/Users/sebastienlorber/Desktop/docusaurus-reproductible-broken-link/node_modules/@docusaurus/utils/lib/jsUtils.js:44:24)
at async Command.build (/Users/sebastienlorber/Desktop/docusaurus-reproductible-broken-link/node_modules/@docusaurus/core/lib/commands/build.js:82:21) {
[cause]: Error: Docusaurus found broken links!
Please check the pages of your site in the list below, and make sure you don't reference any path that does not exist.
Note: it's possible to ignore broken links with the 'onBrokenLinks' Docusaurus configuration, and let the build pass.
Exhaustive list of all broken links found:
- Broken link on source page path = /docs/CustomPickSectionItem:
-> linking to EndpointIPAMConfig.md (resolved as: /docs/EndpointIPAMConfig.md)
- Broken link on source page path = /docs/EndpointSettings:
-> linking to EndpointIPAMConfig.md (resolved as: /docs/EndpointIPAMConfig.md)
at throwError (/Users/sebastienlorber/Desktop/docusaurus-reproductible-broken-link/node_modules/@docusaurus/logger/lib/index.js:79:11)
at reportBrokenLinks (/Users/sebastienlorber/Desktop/docusaurus-reproductible-broken-link/node_modules/@docusaurus/core/lib/server/brokenLinks.js:242:47)
at handleBrokenLinks (/Users/sebastienlorber/Desktop/docusaurus-reproductible-broken-link/node_modules/@docusaurus/core/lib/server/brokenLinks.js:274:5)
at buildLocale (/Users/sebastienlorber/Desktop/docusaurus-reproductible-broken-link/node_modules/@docusaurus/core/lib/commands/build.js:192:47)
at async tryToBuildLocale (/Users/sebastienlorber/Desktop/docusaurus-reproductible-broken-link/node_modules/@docusaurus/core/lib/commands/build.js:46:20)
at async mapAsyncSequential (/Users/sebastienlorber/Desktop/docusaurus-reproductible-broken-link/node_modules/@docusaurus/utils/lib/jsUtils.js:44:24)
at async Command.build (/Users/sebastienlorber/Desktop/docusaurus-reproductible-broken-link/node_modules/@docusaurus/core/lib/commands/build.js:82:21)
}
[INFO] Docusaurus version: 3.1.1
Node version: v20.11.0
error Command failed with exit code 1.
The error cause is appropriately printed, and display useful information to troubleshot the problem.
Additional Context/Questions
StackBlitz is useful for Docusaurus users to provide reproduction cases, and also for me as a maintainer to not have to run repro code locally for security.
Seeing obfuscated errors unfortunately forces me to run the code outside StackBlitz to be able to see the good expected error message.
Otherwise, Docusaurus keeps building fine in StackBlitz 👍
Is this still an issue? I opened the project and it seems to be building fine. I know we had issues in the past with the encoding, but we fixed that. Maybe we did miss something though.
I'll look into it tomorrow.
Not sure why but yarn install became much slower recently on https://docusaurus.new/stackblitz-ts
It hangs forever on this step:
Running yarn build on the provided repro still gives me this error:
Now I'm not sure what's causing that problem exactly, this sandbox has been provided by someone as a bug report. I'm unable to get that error again if I try to create a more minimal repro.
Note that it happens at the end of the webpack build, and in former versions of Docusaurus we used to run the SSG phase as a webpack plugin at the end of the build. Now we moved SSG as a separate step that comes after the webpack build, that might explain why I can't reproduce anymore.
In that former version, we had a Webpack plugin do the SSG phase using a Node vm.Script (through https://github.com/pierrec/node-eval), maybe that specific combination caused troubles? 🤷♂️
Oh I see. Thanks for the additional information. It could be that it's because of the vm.Script. We don't support all features as it's very trick to get right and to get everything working as it should.
yarn install does feel pretty slow indeed. This might be related to a change we made not too long ago. I'll see if I can investigate this but can't promise anything in regards to timing.
@slorber Just wanted to let you know that we prioritized the slow yarn install issue and I'm actively working on resolving that. Will keep you posted.
Thanks @SamVerschueren !
Regarding the other sb_expose error, it might be vm.Script as well be due to using webpack stats. I've always thought it a bit hard to reason about, and sometimes it's difficult to figure out how to print full stack traces from Webpack errors.