docusaurus icon indicating copy to clipboard operation
docusaurus copied to clipboard

Do not transform static JS assets

Open soptim-erke opened this issue 5 months ago • 7 comments

Have you read the Contributing Guidelines on 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

Static assets ending in .js seem to be modified in a docusaurus build.

Reproducible demo

No response

Steps to reproduce

Create a new Docusaurus project.

npx create-docusaurus@latest my-website classic --typescript
cd my-website

Create a static asset containing some JavaScript.

echo "let a = 1; let b = 2;" > ./static/example.js

Build and serve the project.

npm run build
npm run serve

Open localhost:3000/example.js in your browser and observe that the content served by the browser does not look like the original file anymore, but like this.

let a=1,b=2;

This does not happen when renaming the file to use a different extension, such as .txt.

Expected behavior

I would expect Docusaurus not to modify the contents of static .js assets.

Actual behavior

Docusaurus actually transformed the asset.

Your environment

  • Docusaurus version used: 3.5.2
  • Result of uname -a: MSYS_NT-10.0-19045 NB01508 3.4.10-2e2ef940.x86_64 2024-07-09 21:35 UTC x86_64 Msys
  • Environment: Chrome Version 128.0.6613.113 (Official Build) (64-bit)

Self-service

  • [X] I'd be willing to fix this bug myself.

soptim-erke avatar Aug 30 '24 11:08 soptim-erke