Open dPowNextdoor opened 2 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Custom imports/exports don't work in
@svgr/webpack
v6.2.1 like the did in v5Bug Report
I cannot customize the exports of the resulting JavaScript/TypeScript SVGR output, regardless of any permutation of possible options/configs that may exist.
To Reproduce
Neither this:
Nor this:
Nor even this:
Will work in order to get (what should obviously be the default behavior of) fixing v6's behavior to match that of the original, correct, v5 behavior of
import SvgUrl, { ReactComponent as SvgComponent } from '/path/to/my-file.svg'
.Expected behavior
Users to be able to customize the exports such that they include multiple named and/or modified default exports.
e.g. I should be able to customize the
template()
to produce:import SvgUrl, { ReactComponent } from 'my-file.svg'
import { SvgUrl, ReactComponent } from 'my-file.svg'
import { SvgUrl, ReactComponent, SvgFileContentsString } from 'my-file.svg'
Link to repl or repo (highly encouraged)
import * as SvgModule from '@/assets/react_logo.svg'; console.log(SvgModule);
to src/components/Home/Home.jsx.instead of
How would a user do this?
template
clearly doesn't work and there isn't a way to modify thecomponentInfo.exports
array nor specify multipleexportType
config entries without running your own custom AST parser and appending it to the AST output-array.Environment
Related