Describe the bug
When using the docusaurus-openapi-docs plugin, the global URL constructor is undefined. This breaks code that depends on URL, such as the Microsoft Authentication Library for React (msal-react) loginPopup in my application.
Observations:
- When disabling the
docusaurus-openapi-docs plugin, URL is properly defined.
- This issue occurs when customizing the
ApiItem component in the plugin's theme.
Expected behavior
The global URL constructor should be defined and accessible in the same way as in a default Docusaurus environment.
Current behavior
URL is undefined inside the customized ApiItem component from the docusaurus-openapi-docs plugin. It is probably same for other components.
URL is defined correctly when using the standard DocItemLayout from @docusaurus/theme-classic.
Possible solution
The URL constructor may be overwritten or removed by some internal logic in the plugin.
Steps to reproduce
- Copy the
ApiItem folder from docusaurus-theme-openapi-docs/src/theme into yoursrc/theme folder.
- Inside
src/theme/ApiItem/Layout.js, add:
console.log("URL:", URL);
- Run the project.
- Observe that
URL is undefined.
Compare without the plugin
- Uninstall the
docusaurus-openapi-docs plugin.
- Copy the
DocItem folder from @docusaurus/theme-classic/lib/theme/DocItem/Layout into src/theme.
- Add the same console log inside the component.
- Observe that
URL is now correctly defined.
Console Output (with docusaurus-openapi-docs enabled):
Console Output (with docusaurus-openapi-docs disabled):
URL: ƒ URL() { [native code] }
Context
This issue breaks Microsoft Authentication Library for React (msal-react) loginPopup method, which internally depends on URL. The issue blocks the authentication flow in my application.
Your Environment
- Version used:
docusaurus-openapi-docs (latest version at the time of writing)
- Docusaurus version: 3.7.0
- Environment name and version: Chrome Version 134.0.6998.119 (Official Build) (arm64), Node.js v22.14.0
- Operating System and version: macOS Sequoia 15.0.1
Describe the bug
When using the
docusaurus-openapi-docsplugin, the globalURLconstructor is undefined. This breaks code that depends onURL, such as the Microsoft Authentication Library for React (msal-react)loginPopupin my application.Observations:
docusaurus-openapi-docsplugin,URLis properly defined.ApiItemcomponent in the plugin's theme.Expected behavior
The global URL constructor should be defined and accessible in the same way as in a default Docusaurus environment.
Current behavior
URLis undefined inside the customizedApiItemcomponent from thedocusaurus-openapi-docsplugin. It is probably same for other components.URLis defined correctly when using the standardDocItemLayoutfrom@docusaurus/theme-classic.Possible solution
The URL constructor may be overwritten or removed by some internal logic in the plugin.
Steps to reproduce
ApiItemfolder fromdocusaurus-theme-openapi-docs/src/themeinto yoursrc/themefolder.src/theme/ApiItem/Layout.js, add:URLis undefined.Compare without the plugin
docusaurus-openapi-docsplugin.DocItemfolder from@docusaurus/theme-classic/lib/theme/DocItem/Layoutintosrc/theme.URLis now correctly defined.Console Output (with
docusaurus-openapi-docsenabled):Console Output (with
docusaurus-openapi-docsdisabled):Context
This issue breaks Microsoft Authentication Library for React (msal-react)
loginPopupmethod, which internally depends onURL. The issue blocks the authentication flow in my application.Your Environment
docusaurus-openapi-docs(latest version at the time of writing)