Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite: works locally, but does not work in production #11

Open
fax1ty opened this issue May 20, 2023 · 2 comments
Open

Vite: works locally, but does not work in production #11

fax1ty opened this issue May 20, 2023 · 2 comments

Comments

@fax1ty
Copy link

fax1ty commented May 20, 2023

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

@fax1ty
Copy link
Author

fax1ty commented May 20, 2023

image
The problem occurs because I use the Html component
After building, styles are still inserted by injecting

@fax1ty
Copy link
Author

fax1ty commented May 21, 2023

Also, it doesn't work if something uses raf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant