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

fix(react): add fallback for SVG imports coming from non-TS/JS modules #2351

Merged
merged 1 commit into from
Jan 21, 2020

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Jan 20, 2020

This PR allows SVG files to be imported from non-JS/TS files (e.g. CSS) by using oneOf to use the rule that matches first.

@jaysoo jaysoo mentioned this pull request Jan 20, 2020
4 tasks
@catfireparty
Copy link
Contributor

I've added this to the next webpack config and tried it out, seems to work there too, although I had to add an index.d.ts file with this content:

declare module '*.svg' {
  const content: any;
  export const ReactComponent: any;
  export default content;
}

Is it worth adding this to the application schematic and creating it automatically for TS projects?

Also...how do we test this?

@jaysoo jaysoo merged commit 2088551 into nrwl:master Jan 21, 2020
@jaysoo jaysoo deleted the react-svg branch January 21, 2020 15:07
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants