React Vite

Commands for building React Frontend applications using vite.

INFO

extends vite-scripts

Usage

Adding it to an existing project

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

# configure the cli package to use react-vite-scripts
npm pkg set pota="@pota/react-vite-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
debug{Boolean}falseSets NODE_ENV to 'development'.
watch{Boolean}falseRun build and watch for changes.
output{String}./distThe build output directory.
source-map{Boolean}falseEnable source-map generation
force{Boolean}falseIgnore pre-bundled dependencies (the node_modules/.vite cache).
public-path{String}/The location of static assets on your production server.
log-level{'info' | 'warn' | 'error' | 'silent'}infoAdjust console output verbosity. (https://vitejs.dev/config/#loglevel)

dev

Start the development server.

npx pota dev
OptionTypeDefaultDescription
https{Boolean}falseEnables the server's listening socket for TLS (by default, dev server will be served over HTTP)
open{Boolean}trueAllows to configure dev server to open the browser after the server has been started.
host{String | Boolean}127.0.01Specify which IP addresses the server should listen on.
port{Number}2001Allows configuring the port.
cors{ Boolean }falseEnables CORS.
prod{Boolean}falseSets NODE_ENV to 'production'.
force{Boolean}falseIgnore pre-bundled dependencies (the node_modules/.vite cache).
public-path{String}/The location of static assets on your production server.
log-level{'info' | 'warn' | 'error' | 'silent'}infoAdjust console output verbosity. (https://vitejs.dev/config/#loglevel)

preview

Locally preview the production build.

npx pota preview
OptionTypeDefaultDescription
https{Boolean}falseEnables the server's listening socket for TLS (by default, dev server will be served over HTTP)
open{Boolean}trueAllows to configure dev server to open the browser after the server has been started.
host{String | Boolean}127.0.01Specify which IP addresses the server should listen on.
port{Number}2001Allows configuring the port.
cors{Boolean}falseEnables CORS.
force{Boolean}falseIgnore pre-bundled dependencies (the node_modules/.vite cache).
public-path{String}/The location of static assets on your production server.
log-level{'info' | 'warn' | 'error' | 'silent'}infoAdjust console output verbosity. (https://vitejs.dev/config/#loglevel)

Config Reference [WIP]

see vite-scripts