-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not transform static JS assets #10460
Comments
This is probably due to webpack minifying css js html files and probably other too to lower the bundle size when building your site. What is your usecase with these js files in the static folder ? |
Static files should never be changed. They could be example code that's downloaded. I thought there's a similar issue but I can't find it now. |
Ah, #10334 should be similar. Perhaps they are the same issue. |
That is what I understood from the docs saying that none of the files in the static folder will be post-processed, hashed, or minified.
That is exactly what we are trying to achieve. We have a bunch of code snippets in the |
Perhaps related to #10334 "Docusaurus 3.4.0+ does not respect PostCSS plugins when it minimizes CSS files from 'static' folder". The bullet-proof approach is to leave the static resources intact. |
As mentioned above, JS and CSS files in the static folder are getting minified since Docusaurus 3.4. In our case, we put API reference files in the In conclusion, I agree with @soptim-erke and @hrumhurum's comments on leaving the static resources intact. |
After upgrading to latest docusaurus (3.1.1 to 3.5.2) I also experienced this issue. We have a static folder full of pre-built code that is now altered after running For people also experiencing this: I found that using the workaround (outlined in #10334) by setting |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
Static assets ending in
.js
seem to be modified in adocusaurus 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.
Build and serve the project.
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.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
uname -a
: MSYS_NT-10.0-19045 NB01508 3.4.10-2e2ef940.x86_64 2024-07-09 21:35 UTC x86_64 MsysSelf-service
The text was updated successfully, but these errors were encountered: