Open
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I'm using the latest version of Docusaurus.
- I have tried the
npm run clear
oryarn clear
command. - I have tried
rm -rf node_modules yarn.lock package-lock.json
and re-installing packages. - I have tried creating a repro with https://new.docusaurus.io.
- I have read the console error message carefully (if applicable).
Description
Something similar to #10460
Reproducible demo
No response
Steps to reproduce
This is simple to reproduce.
- Create a fresh docusaurus site.
- Create a file
static/assets/upload/test.js
:
{
- / -sss;
}
- Create a link in the documentation to this file
---
sidebar_position: 6
---
# Congratulations!
[Test](/assets/upload/test.js)
This will break a build (rspack also).
It looks like #10460.
If the ‘invalid’ JavaScript is in the folder, but there is no reference to it, everything will build correctly.
Expected behavior
Documentation is built even if there is a reference to an invalid JavaScript file in static assets.
Actual behavior
[ERROR] Client bundle compiled with errors therefore further build is impossible.
SyntaxError: /temp/docusaurus-rs-pack/my-website/static/assets/upload/test.js: Unterminated regular expression. (2:5)
1 | {
> 2 | - / -sss;
| ^
3 | }
4 |
at parser.next (<anonymous>)
at normalizeFile.next (<anonymous>)
at run.next (<anonymous>)
at transform.next (<anonymous>)
Your environment
docusaurus 3.7.0
node 20.17.0
npm 10.8.2
Self-service
- I'd be willing to fix this bug myself.