Vite actually runs nearly instantly:
However, when I try visiting the url, I have a blank page that loads for a while, and after that, everytime I try loading a page for the first time, a similar waiting time ensues, except the already loaded components, such as the navbar and header, don't need to rerender:
Here's my package.json
:
{
"name": "myapp",
"version": "6.1.0",
"author": "redacted",
"homepage": "redacted",
"private": true,
"scripts": {
"dev": "vite --port 3000",
"build": "tsc && vite build",
"preview": "vite preview",
"lint": "eslint . --ext .ts,.tsx"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"dependencies": {
"@auth0/auth0-spa-js": "2.0.3",
"@aws-amplify/auth": "5.1.8",
"@emotion/cache": "11.10.5",
"@emotion/react": "^11.10.5",
"@emotion/server": "11.10.0",
"@emotion/styled": "^11.10.5",
"@fullcalendar/core": "6.1.4",
"@fullcalendar/daygrid": "6.1.4",
"@fullcalendar/interaction": "6.1.4",
"@fullcalendar/list": "6.1.4",
"@fullcalendar/react": "6.1.4",
"@fullcalendar/timegrid": "6.1.4",
"@fullcalendar/timeline": "6.1.4",
"@loadable/component": "^5.15.3",
"@mui/icons-material": "5.11.9",
"@mui/lab": "5.0.0-alpha.120",
"@mui/material": "^5.11.9",
"@mui/system": "5.11.9",
"@mui/x-date-pickers": "5.0.18",
"@react-pdf/renderer": "3.1.4",
"@reduxjs/toolkit": "1.8.5",
"@syncfusion/ej2": "^20.4.54",
"@syncfusion/ej2-react-grids": "^20.4.54",
"@untitled-ui/icons-react": "0.1.0",
"apexcharts": "3.37.0",
"aws-amplify": "5.0.14",
"axios": "^1.3.4",
"date-fns": "2.29.3",
"draft-js": "0.11.7",
"firebase": "9.17.1",
"formik": "2.2.9",
"framer-motion": "^10.6.0",
"fuse": "^0.4.0",
"fuse.js": "^6.6.2",
"gray-matter": "4.0.3",
"i18next": "22.4.9",
"lodash.debounce": "4.0.8",
"lodash.isequal": "4.5.0",
"mapbox-gl": "2.12.1",
"mui-one-time-password-input": "1.0.4",
"nprogress": "0.2.0",
"numeral": "2.0.6",
"prop-types": "15.8.1",
"react": "18.2.0",
"react-apexcharts": "1.4.0",
"react-beautiful-dnd": "13.1.1",
"react-dom": "18.2.0",
"react-draft-wysiwyg": "1.15.0",
"react-dropzone": "14.2.3",
"react-helmet-async": "1.3.0",
"react-hot-toast": "2.4.0",
"react-i18next": "12.1.5",
"react-map-gl": "7.0.21",
"react-markdown": "8.0.5",
"react-quill": "2.0.0",
"react-redux": "8.0.5",
"react-router": "6.8.1",
"react-router-dom": "6.8.1",
"react-slick": "0.29.0",
"react-syntax-highlighter": "15.5.0",
"redux": "4.2.1",
"redux-devtools-extension": "2.13.9",
"redux-thunk": "2.4.2",
"simplebar-react": "3.2.1",
"styled-components": "^5.3.9",
"stylis": "4.1.3",
"stylis-plugin-rtl": "2.0.2",
"yup": "1.0.0"
},
"devDependencies": {
"@svgr/webpack": "6.5.1",
"@types/lodash": "4.14.191",
"@types/node": "18.13.0",
"@types/nprogress": "0.2.0",
"@types/numeral": "2.0.2",
"@types/react": "18.0.28",
"@types/react-beautiful-dnd": "13.1.3",
"@types/react-dom": "18.0.11",
"@types/react-draft-wysiwyg": "1.13.4",
"@types/react-redux": "7.1.25",
"@types/react-slick": "0.23.10",
"@types/styled-components": "^5.1.26",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@vitejs/plugin-react": "^3.1.0",
"autoprefixer": "^10.4.13",
"eslint": "8.34.0",
"eslint-config-prettier": "^8.6.0",
"eslint-import-resolver-typescript": "^3.5.3",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"postcss": "^8.4.21",
"postcss-cli": "^10.1.0",
"prettier": "2.8.4",
"tailwindcss": "^3.2.7",
"typescript": "4.9.5",
"vite": "^4.1.4",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-svgr": "^2.4.0",
"vite-tsconfig-paths": "^4.0.5"
}
}
My vite.config.ts
:
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import viteTsconfigPaths from 'vite-tsconfig-paths';
import svgrPlugin from 'vite-plugin-svgr';
import eslint from 'vite-plugin-eslint';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
eslint({
emitWarning: true,
emitError: true,
failOnError: true,
}),
viteTsconfigPaths(),
svgrPlugin(),
],
});
If it helps, I'm also using Tailwind with the standard config file.
Here's the redacted Gist with the HAR generated by Chrome.
This is immensely slowing down development. The project isn't big enough to warrant this much of a slowdown.