Skip to content

fix(svgx): include now-required import attribute for text - #380

Open
JakobJingleheimer wants to merge 1 commit into
mainfrom
svgx/fix/add-import-attr-for-text
Open

fix(svgx): include now-required import attribute for text#380
JakobJingleheimer wants to merge 1 commit into
mainfrom
svgx/fix/add-import-attr-for-text

Conversation

@JakobJingleheimer

@JakobJingleheimer JakobJingleheimer commented Aug 3, 2026

Copy link
Copy Markdown
Member

Fixes #381

This injects the now-required import attribute.

Copilot AI review requested due to automatic review settings August 3, 2026 19:24
@JakobJingleheimer JakobJingleheimer added bug Something isn't working pkg:svgx labels Aug 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the SVGX loader to stay compatible with Node.js’s native type: "text" import-attribute requirement for text-format loads, by injecting the appropriate importAttributes when delegating to nextLoad.

Changes:

  • Pass importAttributes: { type: 'text' } (merging any existing attributes) when calling nextLoad with format: 'text' for .svg files.
  • Preserve prior behavior for non-.svg files and downstream JSX transformation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +34 to +38
nextLoad(url, {
...ctx,
format: 'text',
importAttributes: { ...ctx.importAttributes, type: 'text' },
}),
@AugustinMauroy

Copy link
Copy Markdown
Member

@JakobJingleheimer it's still not working

@JakobJingleheimer

JakobJingleheimer commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

Yes, I know. I think node's handling of text imports (nodejs/node#62300) is b0rked:

import './fixture.svg';
ERR_IMPORT_ATTRIBUTE_MISSING]: Module "file:///…/fixture.svg" needs an import attribute of "type: text"
import './fixture.svg' with { type: 'text' };
[ERR_IMPORT_ATTRIBUTE_UNSUPPORTED]: Import attribute "type" with value "text" is not supported in file:///…/fixture.svg

I posted in #nodejs-core

@AugustinMauroy

Copy link
Copy Markdown
Member

oh sad ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working pkg:svgx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SVGX loader broken

3 participants