Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tsParticles has worse performance on live-server

I am currently stuck and unable to locate the error. After building my react application containing the react-tsParticles package, I noticed a immense worse performance after publishing it on my nginx-based webserver. While in local development performance is fine, but the performance when visiting the live page is bad and not comparable to other examples on the internet.

I am not interested in advertising my page, but this is the link to it. The Code can be found here on Github.

Any advice is appreciated :)

like image 454
Michael Holley Avatar asked Sep 05 '25 03:09

Michael Holley


2 Answers

If anyone comes across this in 2024 and you are using react-vite project, using browserlist etc. won't help much I tried everything. what worked for me is to change vite.config file and using chunking stragery it impacts how node_modules are bundled and served.

 build: {
    rollupOptions: {
      output: {
        manualChunks(id) {
          if (id.includes("node_modules")) {
            return "vendor";
          }
        },
      },
    },
  },
like image 147
Kamal Jyotwal Avatar answered Sep 07 '25 22:09

Kamal Jyotwal


I had this problem too

there is a problem with the build tool or bundle file that occurs when using the npm run build command.

also may be solved by changing the browserslist in package.json.

you can refer to this answer : https://stackoverflow.com/a/70625114/8730051

like image 28
Hamed Lohi Avatar answered Sep 07 '25 23:09

Hamed Lohi