I am trying to finish a migration away from Parcel and into Vite. We use caddy to reverse proxy a custom domain locally through a Docker container. The issue I'm having is that when I load the client in browser it continuously refreshes, the console saying that vite is connecting, then "server connection lost, polling for restart" in a loop.
Here is the vite.config.json:
// @ts-ignore
import tailwindcss from "@tailwindcss/jit";
import react from "@vitejs/plugin-react";
// import reactRefresh from "@vitejs/plugin-react-refresh";
// @ts-ignore
import dotenv from "dotenv";
// import postcssImport from "postcss-import";
import presetEnv from "postcss-preset-env";
import { defineConfig } from "vite";
// export default (() => {
// Object.assign(process.env, loadEnv("", ".."));
// dotenv.config({ path: "../.env" });
// now you can access config with process.env.{configName}
export default defineConfig({
server: {
host: "0.0.0.0",
// hmr: false,
port: 1234,
},
plugins: [react()],
css: {
postcss: {
plugins: [
tailwindcss,
presetEnv({ stage: 1 }),
],
},
},
});
// });
I've pull the container logs and don't see any crashes reported. I've tried toying with the config but to no real effect.