Vite: works locally, but does not work in production
fax1ty opened this issue · comments
Davydov Artyom commented
I got
Uncaught ReferenceError: document is not defined
on production, but everything is ok locally
vite.config.ts
import eslintPlugin from "@nabla/vite-plugin-eslint";
import react from "@vitejs/plugin-react";
import autoprefixer from "autoprefixer";
import dns from "dns";
import postcssLogical from "postcss-logical";
import { defineConfig } from "vite";
import svgr from "vite-plugin-svgr";
dns.setDefaultResultOrder("verbatim");
export default defineConfig({
assetsInclude: ["**/*.glb", "**/*.gltf", "**/*.hdr", "**/*.riv"],
server: {
host: "localhost",
port: 3000,
},
plugins: [react({ fastRefresh: false }), svgr(), eslintPlugin()],
worker: { plugins: [react()] },
esbuild: { jsx: "automatic" },
css: {
postcss: {
plugins: [autoprefixer, postcssLogical],
},
},
});
also not working with @vitejs/plugin-react-swc
Davydov Artyom commented
The problem occurs because I use the Html
component
After building, styles are still inserted by injecting
Davydov Artyom commented
Also, it doesn't work if something uses raf