How to configure Terser in Remix.run (2.5.0)?

25 Views Asked by At

I'm trying to set my Remix (2.5.0) app to use Terser but it seems that it is not working.

With the following configuration I was expecting not seeing console.logs but I still can see then and inspecting the source on the browser I can still see the console.log there.

Here is my remix.config file:

import TerserPlugin from 'terser-webpack-plugin';
import terserOptions from './terser.config.js';

export default {
   ignoredRouteFiles: ["**/.*"],
   server: "./server.ts",
   serverBuildPath: "functions/[[path]].js",
   serverConditions: ["workerd", "worker", "browser"],
   serverDependenciesToBundle: "all",
   serverMainFields: ["browser", "module", "main"],
   serverMinify: true,
   serverModuleFormat: "esm",
   serverPlatform: "neutral",
   optimization: {
      minimize: true,
      minimizer: [new TerserPlugin({ terserOptions })],
   },
...

And here is my terser.config.js file:

export default {
   compress: {
     drop_console: true,
   },
   mangle: true, // Note `mangle.properties` is `false` by default.
 }
0

There are 0 best solutions below