Skip to content

Commit

Permalink
Merge pull request #9 from rarimo/fix/build
Browse files Browse the repository at this point in the history
fix build
  • Loading branch information
WhiteNik16 authored Dec 7, 2023
2 parents a34aa43 + 1816295 commit 1d32bfd
Show file tree
Hide file tree
Showing 5 changed files with 703 additions and 20 deletions.
8 changes: 2 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0">
<meta name="description" content="react-template">
<meta property="og:title" content="react-template">
<meta property="og:description" content="react-template">
<meta property="og:url" content="https://rarime-dashboard.com">
<meta property="og:description" content="rarime-dashboard">
<meta property="og:url" content="https://dashboard.rarime.com">
<meta property="og:image" content="/branding/logo.png">
<meta property="og:locale" content="en_GB">
<meta property="og:type" content="website">
Expand All @@ -33,10 +33,6 @@
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">

<link rel="preload" href="/branding/fonts/NunitoSans/NunitoSans-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="/branding/fonts/NunitoSans/NunitoSans-SemiBold.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="/branding/fonts/NunitoSans/NunitoSans-Bold.woff2" as="font" type="font/woff2" crossorigin="anonymous">

<link rel="preload" href="/branding/fonts/EuclidCirculiarB/Euclid-Circular-B-Regular.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="/branding/fonts/EuclidCirculiarB/Euclid-Circular-B-SemiBold.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="/branding/fonts/EuclidCirculiarB/Euclid-Circular-B-Bold.woff2" as="font" type="font/woff2" crossorigin="anonymous">
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
},
"devDependencies": {
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@originjs/vite-plugin-commonjs": "^1.0.3",
"@types/lodash": "^4.14.195",
"@types/node": "^20.3.1",
Expand Down Expand Up @@ -84,6 +85,7 @@
"typescript": "^5.1.3",
"vite": "^4.3.9",
"vite-plugin-checker": "^0.6.1",
"vite-plugin-node-polyfills": "^0.9.0",
"vite-plugin-svg-icons": "^2.0.1",
"vite-tsconfig-paths": "^4.0.3",
"yorkie": "^2.0.0"
Expand Down
7 changes: 4 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,21 @@ export const App: FC<HTMLAttributes<HTMLDivElement>> = ({ children }) => {
}, [width])

const init = async () => {
if (provider?.address) return

try {
if (provider?.address) return
if (await checkMetamaskExists()) {
await initWeb3()

if (await checkSnapExists()) {
await connectOrInstallSnap()
}

setIsAppInitialized(true)
}
} catch (error) {
ErrorHandler.processWithoutFeedback(error)
}

setIsAppInitialized(true)
}

useEffect(() => {
Expand Down
28 changes: 28 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill'
import react from '@vitejs/plugin-react'
/**
* @description Enable import if you need polyfills
Expand All @@ -11,6 +13,7 @@ import * as path from 'path'
import { visualizer } from 'rollup-plugin-visualizer'
import { defineConfig, loadEnv } from 'vite'
import { checker } from 'vite-plugin-checker'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import tsconfigPaths from 'vite-tsconfig-paths'

Expand Down Expand Up @@ -83,6 +86,31 @@ export default defineConfig(({ mode }) => {
'@static': `${root}/../static`,
},
},
optimizeDeps: {
disabled: false,
esbuildOptions: {
define: {
global: 'globalThis',
},
},
plugins: [
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true,
}),
NodeModulesPolyfillPlugin(),
],
},
build: {
target: 'esnext',
rollupOptions: {
plugins: [nodePolyfills()],
},
commonjsOptions: {
include: [],
transformMixedEsModules: true,
},
},
/**
* @description Enable configuration for polyfills
*
Expand Down
Loading

0 comments on commit 1d32bfd

Please sign in to comment.