Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Apache Druid WebpackConfig

From Leeroopedia


Knowledge Sources
Domains Web_Console, Build_Configuration
Last Updated 2026-02-10 10:00 GMT

Overview

WebpackConfig is the Webpack build configuration module for the Apache Druid web console application.

Description

The configuration file exports a function that returns a Webpack configuration object supporting both development and production modes. It configures TypeScript compilation via ts-loader (with react-jsx/react-jsxdev based on mode), SCSS/CSS processing through a style-loader/css-loader/postcss-loader/sass-loader pipeline, font asset handling, and a dev server with proxy support for the Druid backend API. The config resolves the Druid host from environment variables or command-line arguments, auto-detects HTTPS for port 9088, and includes DefinePlugin for environment injection, ContextReplacementPlugin for date-fns locale pruning, and optional BundleAnalyzerPlugin support via the BUNDLE_ANALYZER_PLUGIN environment variable. Blueprint SCSS color overrides are enabled via a module alias.

Usage

Used as the primary build configuration when running webpack for development (`webpack serve`) or production builds (`webpack --mode production`) of the Druid web console.

Code Reference

Source Location

Signature

export default (env) => {
  // Returns Webpack configuration object
  return {
    mode: 'development' | 'production',
    entry: { 'web-console': './src/entry.tsx' },
    output: { path, filename, chunkFilename, publicPath },
    resolve: { alias, extensions, fallback },
    devServer: { host, port, hot, static, devMiddleware, open, proxy },
    module: { rules: [/* ts-loader, scss, fonts */] },
    plugins: [/* DefinePlugin, ContextReplacementPlugin, BundleAnalyzerPlugin? */],
  };
};

Import

// Used by webpack CLI directly:
// webpack --config webpack.config.mjs

I/O Contract

Inputs

Name Type Required Description
env object No Webpack environment object; supports env.druid_host for specifying the Druid backend URL
process.env.druid_host string No Environment variable fallback for the Druid backend URL
process.env.NODE_ENV string No Set to 'production' for production builds; defaults to 'development'
process.env.BUNDLE_ANALYZER_PLUGIN string No Set to 'TRUE' to enable webpack-bundle-analyzer on port 18082

Outputs

Name Type Description
Webpack config object Complete Webpack configuration object for building the web console application

Usage Examples

Development build with custom Druid host

# Start dev server proxying to a specific Druid instance
cd web-console
npx webpack serve --env druid_host=my-druid-host:8888

# Production build
NODE_ENV=production npx webpack

# With bundle analyzer
BUNDLE_ANALYZER_PLUGIN=TRUE npx webpack

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment