Search⌘ K
AI Features

Adding npm scripts

Understand how to add and configure npm scripts in a React and TypeScript project to run the app in development mode and create production builds. Learn to use Webpack commands effectively and resolve type errors during development.

Adding the scripts

We are going to leverage npm scripts to start our app in development mode and build a production version of our app. Let’s add a scripts section to package.json with the following scripts:

  ...,
  "scripts": {
    "start": "webpack serve --open --mode development",
    "build": "webpack --mode production"
  },
  ...

Running the app in development mode

Let’s run the following command in a terminal to ...