Repository navigation
Conversation
…ation The default SVGR options now set runtimeConfig to false, which skips svgr.config.js in the site directory and in ancestor directories. Sites that still want file discovery pass svgrConfig with runtimeConfig true. The plugin docs record the new default and point configuration at the svgrConfig option. Loader tests cover a parent TypeScript config, that opt-in, a config inside the site, and a parent file that does not parse. Fixes meta#8646
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Pre-flight checklist
Motivation
A scaffolded site prints that it is running, then the client bundle fails to compile. Inline SVGs are emitted with a TypeScript interface, and the bundler stops on SyntaxError: Unexpected reserved word 'interface'. The failure shows up when custom SVGR settings live in a directory above the site and turn on TypeScript output.
SVGR walks upward from each SVG and applies the first configuration file it finds, including one outside the site. createDefaultSVGRConfig left that search enabled, so a parent file with typescript: true was honored and the transform emitted TypeScript into the JavaScript client compile.
The default SVGR options now set runtimeConfig to false, which skips svgr.config.js in the site directory and in ancestor directories. Sites that still want file discovery pass svgrConfig with runtimeConfig true. The plugin docs record the new default and point configuration at the svgrConfig option. Loader tests cover a parent TypeScript config, that opt-in, a config inside the site, and a parent file that does not parse.
Test Plan
npx --no-install vitest run src/tests/svgrLoader.test.ts passed all 8 tests in @docusaurus/plugin-svgr.
The tests in
packages/docusaurus-plugin-svgr/src/__tests__/svgrLoader.test.tsfail without the fix in the docusaurus createDefaultSVGRConfig change (checked by reverting the source changes).Test links
Covered in the summary above.
Related issues/PRs
Closes #8646
AI was used for assistance.
Summary by CodeRabbit