# underreact **Repository Path**: mirrors_mapbox/underreact ## Basic Information - **Project Name**: underreact - **Description**: A light weight app build system - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-09 - **Last Updated**: 2025-11-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # DEPRECATED! As of April 2022, we are deprecating Underreact and do not recommend usage on new projects. Development will only occur on an exemption basis for existing, internal Mapbox use-cases. New projects should use an alternative such as [Create React App](https://create-react-app.dev/) or [Vite](https://vitejs.dev/). --- # @mapbox/underreact Minimal, extensible React app build system that you won't need to eject. It's a pretty thin wrapper around Babel, Webpack, and PostCSS, and will never accumulate an ecosystem of its own. And it aims to be just as useful for production applications with idiosyncratic demands as for simple prototypes. ## Table of contents - [Installation](#installation) - [Getting started](#getting-started) - [Usage](#usage) - [Underreact configuration file](#underreact-configuration-file) - [Defining your HTML](#defining-your-html) - [Modes](#modes) - [Development mode](#development-mode) - [Production mode](#production-mode) - [Babel](#babel) - [Exposing babel.config.js](#exposing-babelconfigjs) - [Browser support and polyfills](#browser-support-and-polyfills) - [Transpiling JavaScript syntax and vendor-prefixing CSS](#transpiling-javascript-syntax-and-vendor-prefixing-css) - [Polyfilling newer JavaScript features](#polyfilling-newer-javascript-features) - [Using @babel/polyfill](#using-babelpolyfill) - [Deployment environments](#deployment-environments) - [Using environment variables](#using-environment-variables) - [DEPLOY_ENV and NODE_ENV](#deploy_env-and-node_env) - [Why set DEPLOY_ENV instead of NODE_ENV?](#why-set-deploy_env-instead-of-node_env) - [Configuration object properties](#configuration-object-properties) - [browserslist](#browserslist) - [compileNodeModules](#compilenodemodules) - [devServerHistoryFallback](#devserverhistoryfallback) - [environmentVariables](#environmentvariables) - [hot](#hot) - [htmlSource](#htmlsource) - [jsEntry](#jsentry) - [liveReload](#livereload) - [outputDirectory](#outputdirectory) - [polyfill](#polyfill) - [port](#port) - [postcssPlugins](#postcssplugins) - [publicAssetsPath](#publicassetspath) - [publicDirectory](#publicdirectory) - [siteBasePath](#sitebasepath) - [stats](#stats) - [vendorModules](#vendormodules) - [webpackConfigTransform](#webpackconfigtransform) - [webpackLoaders](#webpackloaders) - [webpackPlugins](#webpackplugins) - [FAQs](#faqs) - [How do I make Jest use Underreact's Babel configuration ?](#how-do-i-make-jest-use-underreacts-babel-configuration-) - [How do I dynamically import JavaScript modules or React components?](#how-do-i-dynamically-import-javascript-modules-or-react-components) - [How do I reduce my build size?](#how-do-i-reduce-my-build-size) - [How do I include SVGs, images, and videos?](#how-do-i-include-svgs-images-and-videos) - [How do I enable hot module reloading ?](#how-do-i-enable-hot-module-reloading-) ## Installation Requirements: - Node 6+. Install Underreact as a devDependency of your project: ```bash npm install --save-dev @mapbox/underreact ``` If you are building a React application, you also need to install React dependencies: ```bash npm install react react-dom ``` Add `_underreact*` to your `.gitignore`, and maybe other ignore files (e.g. `.eslintignore`). That way you'll ignore files that Underreact generates. (If you set the [`outputDirectory`](#outputdirectory) option, you'll want to ignore your custom output directory.) ### Getting started #### The bare minimum to get started - Create your entry JS file at `src/index.js`. ```js // src/index.js console.log('hello world!'); ``` - Run the development server with `underreact`. ```bash npx underreact start # or node node_modules/.bin/underreact start ``` - Open the URL printed in your terminal. #### Getting started with React - Create your entry JS file at `src/index.js`. ```jsx // src/index.js import React from 'react'; import ReactDOM from 'react-dom'; class App extends React.Component { render() { return