logo
  • Guide
  • Config
  • Plugin
  • API
  • Examples
  • Community
  • Modern.js 2.x Docs
  • English
    • 简体中文
    • English
    • Start
      Introduction
      Quick Start
      Upgrading
      Glossary
      Tech Stack
      Core Concept
      Page Entry
      Build Engine
      Web Server
      Basic Features
      Routes
      Routing
      Config Routes
      Data Solution
      Data Fetching
      Data Writing
      Data Caching
      Rendering
      Server-Side Rendering
      Streaming SSR
      Rendering Cache
      Static Site Generation
      Render Preprocessing
      Styling
      Styling
      Use CSS Modules
      Using CSS-in-JS
      Using Tailwind CSS
      HTML Template
      Import Static Assets
      Import JSON Files
      Import SVG Assets
      Import Wasm Assets
      Debug
      Data Mocking
      Network Proxy
      Using Rsdoctor
      Using Storybook
      Testing
      Playwright
      Vitest
      Jest
      Cypress
      Path Alias
      Environment Variables
      Output Files
      Deploy Application
      Advanced Features
      Using Rspack
      Using BFF
      Basic Usage
      Runtime Framework
      Extend BFF Server
      Extend Request SDK
      File Upload
      Cross-Project Invocation
      Optimize Page Performance
      Code Splitting
      Inline Static Assets
      Bundle Size Optimization
      React Compiler
      Improve Build Performance
      Browser Compatibility
      Low-Level Tools
      Source Code Build Mode
      Server Monitor
      Monitors
      Logs Events
      Metrics Events
      Internationalization
      Basic Concepts
      Quick Start
      Configuration
      Locale Detection
      Resource Loading
      Routing Integration
      API Reference
      Advanced Usage
      Best Practices
      Custom Web Server
      Topic Detail
      Module Federation
      Introduction
      Getting Started
      Application-Level Modules
      Server-Side Rendering
      Deployment
      Integrating Internationalization
      FAQ
      Dependencies FAQ
      CLI FAQ
      Build FAQ
      HMR FAQ
      Deprecated
      📝 Edit this page
      Previous pageBrowser CompatibilityNext pageSource Code Build Mode

      #Low-Level Tools

      #Usage

      Modern.js internally integrates tools such as Babel, TypeScript, Webpack, PostCSS, Tailwind CSS by default.

      Usually, the default configuration can meet most development needs. When there are special needs, it can be achieved through the underlying configuration.

      Take configuring Rspack as an example, just add tools.rspack to the modern.config.ts:

      modern.config.ts
      export default defineConfig({
        tools: {
          webpack: config => {},
        },
      });

      Configurations in the tools can be set to Object or Function.

      When the value is Object, it will be merged with the default configuration. For the specific merging strategy, refer to the configuration options document (see table below).

      When the value is Function, the first parameter is the default configuration value. You can directly modify this object without returning it, or you can return a new object or a merged object as the final result.

      #Low-level Configuration Details

      Currently provided is as follows:

      ToolsConfig
      DevServertools.devServer
      Babeltools.babel
      PostCSStools.postcss
      Lesstools.less
      Sasstools.sass
      Minify CSStools.minifyCss
      Autoprefixertools.autoprefixer