React Webpack

Commands for building React Frontend applications using webpack.

INFO

extends webpack-scripts

Usage

Adding it to an existing project

# install the react-webpack-scripts and cli packages
npm install @pota/react-webpack-scripts @pota/cli --save-dev

# configure the cli package to use react-webpack-scripts
npm pkg set pota="@pota/react-webpack-scripts"

TIP

Want to extend this scripts package?

Take a look at the extending section of @pota/cli.

Commands

build

Create a production bundle.

npx pota build
OptionTypeDefaultDescription
analyze{Boolean}falseWhen enabled, will open a bundle report after bundling.
cache{Boolean}trueToggles webpack's caching behavior.
image-compression{Boolean}trueToggles image compression.
debug{Boolean}falseSets NODE_ENV to 'development'.
watch{Boolean}falseRun build and watch for changes.
output{String}./distThe build output directory.
source-map{false|devtool}hidden-source-map (production), cheap-source-map (development)Sets the style of source-map, for enhanced debugging. Disable or use faster options in you are having out of memory or other performance issues.
public-path{String}/The location of static assets on your production server.
typecheck{Boolean}trueWhen disabled, will ignore type related errors.
versioning{Boolean}falseWhen enabled, will copy assets in ./static to a versioned directory in the output (e.g. build/version/v2/static/...).
profile{Boolean}falseToggles support for the React Devtools in production.

dev

Start the development server.

npx pota dev
OptionTypeDefaultDescription
cache{Boolean}trueToggle webpack's caching behavior.
https{Boolean}falseRun the development server with HTTPS.
open{Boolean}trueAllows to configure dev server to open the browser after the server has been started.
port{Number}2001Allows configuring the port.
image-compression{Boolean}trueToggles image compression.
prod{Boolean}falseSets NODE_ENV to 'production'.
source-map{false|devtool}hidden-source-map (production), cheap-source-map (development)Sets the style of source-map, for enhanced debugging. Disable or use faster options in you are having out of memory or other performance issues.
typecheck{Boolean}trueToggles checking for type related errors.

Config Reference [WIP]

see webpack-scripts