Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Fix SVGs import syntax #31

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/CRA_MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default defineConfig(({ mode }) => {
CRA allows to transform `.svg` files into React components.

```tsx
import { ReactComponent as Logo } from "./logo.svg";
import { ReactComponent as Logo } from "./logo.svg?react";
ATrogolo marked this conversation as resolved.
Show resolved Hide resolved
```

In order to make this work with Vite we will need a [plugin](https://github.com/pd4d10/vite-plugin-svgr)
Expand Down
297 changes: 165 additions & 132 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"vite-plugin-checker": "^0.6.2",
"vite-plugin-env-compatible": "^1.1.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-svgr": "^3.2.0",
"vite-plugin-svgr": "^4.1.0",
"vitest": "^0.34.2"
}
}
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useState } from "react";
import { Spinner, Text, theme } from "@nordcloud/gnui";
import { useGNUITheme } from "~/hooks/useGnuiTheme";
import { Wrapper, Box, buttonCss } from "~/styles";
import { ReactComponent as Logo } from "./logo.svg";
import Logo from "./logo.svg?react";
import "./App.css";

export function App() {
Expand Down
8 changes: 0 additions & 8 deletions src/custom.d.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* Copyright (c) 2021 Nordcloud Oy or its affiliates. All Rights Reserved. */

/// <reference types="vite/client" />
/// <reference types="vite-plugin-svgr/client" />
Loading