facebook / facebook/docusaurus

Markdown links linking to JS files should resolve to the asset url, not transpiled code

Abierto
#10,855 4 comentarios 0 reacciones 0 asignados Ver en GitHub
bug domain: bundler
Lenguaje dominante
TypeScript
Estrellas
66.2k
Forks
10k
Merge medio
1 d 3 h
PR fusionados (30 d)
52

Descripción

### Have you read the Contributing Guidelines on issues?

- [x] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#issues).

### Prerequisites

- [x] I'm using the latest version of Docusaurus.
- [x] I have tried the `npm run clear` or `yarn clear` command.
- [x] 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.
- [x] I have read the console error message carefully (if applicable).

### Description

Something similar to https://github.com/facebook/docusaurus/issues/10460

### Reproducible demo

_No response_

### Steps to reproduce

This is simple to reproduce.

1. Create a fresh docusaurus site.
1. Create a file `static/assets/upload/test.js`:
```js
{
- / -sss;
}
```
2. Create a link in the documentation to this file
```markdown
---
sidebar_position: 6
---

# Congratulations!

[Test](/assets/upload/test.js)
```

This will break a build (rspack also).
It looks like https://github.com/facebook/docusaurus/issues/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

```text
[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 ()
at normalizeFile.next ()
at run.next ()
at transform.next ()
```

### 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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.