Skip to content
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

Trailing Slash Appended to Asset Files in Docusaurus 3.3.2 #10139

Closed
6 of 7 tasks
karl-cardenas-coding opened this issue May 15, 2024 · 2 comments · Fixed by #10142
Closed
6 of 7 tasks

Trailing Slash Appended to Asset Files in Docusaurus 3.3.2 #10139

karl-cardenas-coding opened this issue May 15, 2024 · 2 comments · Fixed by #10142
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@karl-cardenas-coding
Copy link

karl-cardenas-coding commented May 15, 2024

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn 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

We are attempting to upgrade to Docusarus 3.3.2, and we are noticing an interesting behavior with trailing slashes on asset files. We have by default the following baseURL and trailingSlash configuration

  baseUrl: "/",
  trailingSlash: true,

After the upgrade, if we do a docusarus serve we get a broken page that are missing assets. Upon closer inspection we noticed that asset files are specified with a / at the end. For example runtime-main.d2091a86.js/

image

It's strange that not all files have this behavior.

If we change the trailingSlash configuration to false then this issue goes away.

Reproducible demo

We have a PR in our public repo that can be used to test
spectrocloud/librarium#2839.

Just make sure you set the following env values before starting any server or build

ALGOLIA_APP_ID=1234567890
ALGOLIA_SEARCH_KEY=1234567890

Steps to reproduce

Upgrade to Docusarus 3.3.2 and set the configuration file to have the following baseURL and trailingSlash configuration

  baseUrl: "/",
  trailingSlash: true,

Expected behavior

We would expect asset files to not have an extra / at the end.

Actual behavior

Pages are loading with missing assets.

Your environment

Self-service

  • I'd be willing to fix this bug myself.
@karl-cardenas-coding karl-cardenas-coding added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels May 15, 2024
@slorber
Copy link
Collaborator

slorber commented May 16, 2024

😅 sorry for that, likely a regression introduced by #10090

I forgot serve might not just serve HTML files 😓

@karl-cardenas-coding
Copy link
Author

All good @slorber and thank you for validating what we seemed was a bit odd 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants