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

fix: vite config #378

Merged
merged 1 commit into from
Apr 19, 2024
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
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"istanbul-lib-coverage": "3.2.2",
"nyc": "15.1.0",
"prettier": "3.2.5",
"rollup-plugin-visualizer": "5.12.0",
"standard-version": "9.5.0",
"typescript": "5.4.5",
"vite": "5.2.9",
Expand Down
30 changes: 12 additions & 18 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
/// <reference types="./src/env.d.ts"/>
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
import { visualizer } from 'rollup-plugin-visualizer';
import { PluginOption, UserConfigExport, defineConfig, loadEnv } from 'vite';
import { UserConfigExport, defineConfig, loadEnv } from 'vite';
import checker from 'vite-plugin-checker';
import istanbul from 'vite-plugin-istanbul';

// https://vitejs.dev/config/
const config = ({ mode }: { mode: string }): UserConfigExport => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };

// this defines if we should automatically open the browser
const shouldOpen = process.env.BROWSER && process.env.BROWSER !== 'none';

return defineConfig({
base: '',
server: {
port: parseInt(process.env.VITE_PORT || '3001', 10),
open: true,
open: shouldOpen,
watch: {
ignored: ['**/coverage/**', 'cypress/downloads/**'],
},
},
preview: {
port: parseInt(process.env.VITE_PORT || '3001', 10),
open: shouldOpen,
},
build: {
outDir: 'build',
},
plugins: [
checker({
typescript: true,
eslint: { lintCommand: 'eslint "./**/*.{ts,tsx}"' },
}),
mode !== 'test'
? checker({
typescript: true,
eslint: { lintCommand: 'eslint "./**/*.{ts,tsx}"' },
})
: undefined,
react(),
istanbul({
include: 'src/*',
Expand All @@ -38,17 +43,6 @@ const config = ({ mode }: { mode: string }): UserConfigExport => {
requireEnv: false,
checkProd: true,
}),
...(mode === 'development'
? [
visualizer({
template: 'treemap', // or sunburst
open: true,
gzipSize: true,
brotliSize: true,
filename: 'bundle_analysis.html',
}) as PluginOption,
]
: []),
],
resolve: {
alias: {
Expand Down
58 changes: 1 addition & 57 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7092,13 +7092,6 @@ __metadata:
languageName: node
linkType: hard

"define-lazy-prop@npm:^2.0.0":
version: 2.0.0
resolution: "define-lazy-prop@npm:2.0.0"
checksum: 10/0115fdb065e0490918ba271d7339c42453d209d4cb619dfe635870d906731eff3e1ade8028bb461ea27ce8264ec5e22c6980612d332895977e89c1bbc80fcee2
languageName: node
linkType: hard

"define-properties@npm:^1.1.3, define-properties@npm:^1.1.4, define-properties@npm:^1.2.0, define-properties@npm:^1.2.1":
version: 1.2.1
resolution: "define-properties@npm:1.2.1"
Expand Down Expand Up @@ -9080,7 +9073,6 @@ __metadata:
react-router: "npm:6.22.3"
react-router-dom: "npm:6.22.3"
react-toastify: "npm:10.0.5"
rollup-plugin-visualizer: "npm:5.12.0"
standard-version: "npm:9.5.0"
stylis: "npm:4.3.1"
stylis-plugin-rtl: "npm:2.1.1"
Expand Down Expand Up @@ -9622,15 +9614,6 @@ __metadata:
languageName: node
linkType: hard

"is-docker@npm:^2.0.0, is-docker@npm:^2.1.1":
version: 2.2.1
resolution: "is-docker@npm:2.2.1"
bin:
is-docker: cli.js
checksum: 10/3fef7ddbf0be25958e8991ad941901bf5922ab2753c46980b60b05c1bf9c9c2402d35e6dc32e4380b980ef5e1970a5d9d5e5aa2e02d77727c3b6b5e918474c56
languageName: node
linkType: hard

"is-extglob@npm:^2.1.1":
version: 2.1.1
resolution: "is-extglob@npm:2.1.1"
Expand Down Expand Up @@ -9905,15 +9888,6 @@ __metadata:
languageName: node
linkType: hard

"is-wsl@npm:^2.2.0":
version: 2.2.0
resolution: "is-wsl@npm:2.2.0"
dependencies:
is-docker: "npm:^2.0.0"
checksum: 10/20849846ae414997d290b75e16868e5261e86ff5047f104027026fd61d8b5a9b0b3ade16239f35e1a067b3c7cc02f70183cb661010ed16f4b6c7c93dad1b19d8
languageName: node
linkType: hard

"isarray@npm:^2.0.5":
version: 2.0.5
resolution: "isarray@npm:2.0.5"
Expand Down Expand Up @@ -11364,17 +11338,6 @@ __metadata:
languageName: node
linkType: hard

"open@npm:^8.4.0":
version: 8.4.2
resolution: "open@npm:8.4.2"
dependencies:
define-lazy-prop: "npm:^2.0.0"
is-docker: "npm:^2.1.1"
is-wsl: "npm:^2.2.0"
checksum: 10/acd81a1d19879c818acb3af2d2e8e9d81d17b5367561e623248133deb7dd3aefaed527531df2677d3e6aaf0199f84df57b6b2262babff8bf46ea0029aac536c9
languageName: node
linkType: hard

"optionator@npm:^0.9.3":
version: 0.9.3
resolution: "optionator@npm:0.9.3"
Expand Down Expand Up @@ -12663,25 +12626,6 @@ __metadata:
languageName: node
linkType: hard

"rollup-plugin-visualizer@npm:5.12.0":
version: 5.12.0
resolution: "rollup-plugin-visualizer@npm:5.12.0"
dependencies:
open: "npm:^8.4.0"
picomatch: "npm:^2.3.1"
source-map: "npm:^0.7.4"
yargs: "npm:^17.5.1"
peerDependencies:
rollup: 2.x || 3.x || 4.x
peerDependenciesMeta:
rollup:
optional: true
bin:
rollup-plugin-visualizer: dist/bin/cli.js
checksum: 10/47358feb672291d6edcfd94197577c192a84c24cb644119425dae8241fb6f5a52556efd0c501f38b276c07534642a80c0885ef681babb474e83c7b5a3b475b84
languageName: node
linkType: hard

"rollup@npm:^2.25.0 || ^3.3.0":
version: 3.29.4
resolution: "rollup@npm:3.29.4"
Expand Down Expand Up @@ -14845,7 +14789,7 @@ __metadata:
languageName: node
linkType: hard

"yargs@npm:^17.0.0, yargs@npm:^17.5.1, yargs@npm:^17.7.2":
"yargs@npm:^17.0.0, yargs@npm:^17.7.2":
version: 17.7.2
resolution: "yargs@npm:17.7.2"
dependencies:
Expand Down