Skip to content

Commit 0af54a5

Browse files
committed
fix: svg backgrounds not rendering on production deploys; configure modern scss compiler
1 parent 8b29bb5 commit 0af54a5

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/layout/root.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import { Tooltip } from 'react-tooltip'
1313
import { useEffect } from 'react'
1414
import { CookiesProvider } from 'react-cookie'
1515
import { Chain } from '~/enums'
16-
import flareImg from '../assets/images/protocols/flare/symbol.svg'
17-
import songbirdImg from '../assets/images/protocols/songbird/symbol.svg'
18-
import avalancheImg from '../assets/images/protocols/avalanche/symbol.svg'
16+
import flareImg from '../assets/images/protocols/flare/symbol.svg?url'
17+
import songbirdImg from '../assets/images/protocols/songbird/symbol.svg?url'
18+
import avalancheImg from '../assets/images/protocols/avalanche/symbol.svg?url'
1919

2020

2121
function chainToBackgroundImage(chain: Chain): string {
@@ -52,7 +52,7 @@ const RootLayout = () => {
5252
<>
5353
<Preloader />
5454
<Header />
55-
<div className='background' style={{ backgroundImage: `url(${image})` }}>
55+
<div className='background' style={{ backgroundImage: `url("${image}")` }}>
5656
<CookiesProvider>
5757
<Outlet />
5858
<CallToAction />

vite.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@ import react from '@vitejs/plugin-react'
44
import basicSsl from '@vitejs/plugin-basic-ssl'
55

66

7-
// https://vitejs.dev/config/
87
export default defineConfig({
98
plugins: [react(), basicSsl()],
109
base: '/',
1110
resolve: {
1211
alias: {
1312
'~': path.resolve(__dirname, 'src')
1413
}
14+
},
15+
css: {
16+
preprocessorOptions: {
17+
scss: {
18+
api: "modern-compiler"
19+
}
20+
}
1521
}
1622
})

0 commit comments

Comments
 (0)