Repository: appsmithorg/appsmith
File: app/client/config/webpack.config.js (JavaScript)

Code before:
        },
        {
          loader: require.resolve(preProcessor),
          options: {
            sourceMap: true,
          },
        },
      );
    }
    return loaders;
  };

  return {
    target: ["browserslist"],
    // Webpack noise constrained to errors and warnings
    stats: "errors-warnings",
    mode: isEnvProduction ? "production" : "development",
    // Stop compilation early in production
    bail: isEnvProduction,
    devtool: devtool,
    // These are the "entry points" to our application.
    // This means they will be the "root" imports that are included in JS bundle.
    entry: paths.appIndexJs,
    output: {
      // If airgap is enabled, change the build path
      path: isAirgap ? path.resolve("build_airgap") : paths.appBuild,
      // Add /* filename */ comments to generated require()s in the output.
      pathinfo: isEnvDevelopment,
      // There will be one main bundle, and one file per asynchronous chunk.
      // In development, it does not produce real files.
      filename: isEnvProduction
        ? "static/js/[name].[contenthash:8].js"
        : isEnvDevelopment && "static/js/bundle.js",
      // There are also additional JS chunk files if you use code splitting.
      chunkFilename: isEnvProduction
        ? "static/js/[name].[contenthash:8].chunk.js"
        : isEnvDevelopment && "static/js/[name].chunk.js",
      assetModuleFilename: "static/media/[name].[hash][ext]",
      // webpack uses `publicPath` to determine where the app is being served from.
      // It requires a trailing slash, or the file assets will get an incorrect path.
      // We inferred the "public path" (such as / or /my-project) from homepage.
      publicPath: paths.publicUrlOrPath,
      // Point sourcemap entries to original disk location (format as URL on Windows)
      devtoolModuleFilenameTemplate: isEnvProduction
        ? (info) =>
            path
              .relative(paths.appSrc, info.absoluteResourcePath)
              .replace(/\\/g, "/")
        : isEnvDevelopment &&
          ((info) =>
            path.resolve(info.absoluteResourcePath).replace(/\\/g, "/")),

Review comment (suggestion):
Dev mode only works fine with `cheap-module-source-map`. Other types do not work correctly due to an error in zone.js and we see blank page. The same type of source maps was used earlier in `react-scripts`.
It will be necessary to figure out how to enable recommended type `eval-source-map`. With `eval-source-map`, the app is rebuilt 2 times faster(4s instead 8s).

![Снимок экрана 2025-02-15 в 23 09 51](https://github.com/user-attachments/assets/f7ffd546-9863-43e1-aaf3-4abb3bb822de)
![Appsmith Applications](https://github.com/user-attachments/assets/abae6c40-0a0c-41e5-bc25-24b39244e998)



Code after:
          },
        },
        {
          loader: require.resolve(preProcessor),
          options: {
            sourceMap:
              process.env.REACT_APP_ENVIRONMENT === "PRODUCTION" ||
              process.env.REACT_APP_ENVIRONMENT === "DEVELOPMENT",
          },
        },
      );
    }
    return loaders;
  };

  return {
    target: ["browserslist"],
    // Webpack noise constrained to errors and warnings
    stats: "errors-warnings",
    mode: isEnvProduction ? "production" : "development",
    // Stop compilation early in production
    bail: isEnvProduction,
    devtool:
      (process.env.REACT_APP_ENVIRONMENT === "PRODUCTION" && "source-map") ||
      (process.env.REACT_APP_ENVIRONMENT === "DEVELOPMENT" &&
        "cheap-module-source-map"),
    // These are the "entry points" to our application.
    // This means they will be the "root" imports that are included in JS bundle.
    entry: paths.appIndexJs,
    output: {
      // If airgap is enabled, change the build path
      path: isAirgap ? path.resolve("build_airgap") : paths.appBuild,
      // Add /* filename */ comments to generated require()s in the output.
      pathinfo: isEnvDevelopment,
      // There will be one main bundle, and one file per asynchronous chunk.
      // In development, it does not produce real files.
      filename: isEnvProduction
        ? "static/js/[name].[contenthash:8].js"
        : isEnvDevelopment && "static/js/bundle.js",
      // There are also additional JS chunk files if you use code splitting.
      chunkFilename: isEnvProduction
        ? "static/js/[name].[contenthash:8].chunk.js"
        : isEnvDevelopment && "static/js/[name].chunk.js",
      assetModuleFilename: "static/media/[name].[hash][ext]",
      // webpack uses `publicPath` to determine where the app is being served from.
      // It requires a trailing slash, or the file assets will get an incorrect path.
      // We inferred the "public path" (such as / or /my-project) from homepage.
      publicPath: paths.publicUrlOrPath,
      // Point sourcemap entries to original disk location (format as URL on Windows)
      devtoolModuleFilenameTemplate: isEnvProduction
        ? (info) =>