Skip to main content

Local Development Server

To start a local development server, you can run the following command:

npm start

Alternatively, if you have webpack-cli installed globally, you can also run:

webpack serve

The command above will start a development server on port 4000 and will use the development environment variables. For more information about these variables, please refer to the environment variables section in the documentation.

Once the server is running, you can view your project by accessing the local development server at the URL http://localhost:4000.

Command Options

You can also pass some configuration options to the webpack CLI command, as shown below:

webpack serve --env environment=prod port=4001

Available Options

OptionsDescriptionValue TypeDefault
--env environment=<value>Serve the project using the specified environment.string
--env port=<value>Set the port number for the local development server.number4000
--env open=trueOpens a browser when local development server is ready.booleanfalse
--mode <value>Serve the project in 'development', 'production', or 'none' mode. See webpack mode for more info about the different modes. This option determines whether the build or serve command will generate production or development code.stringdevelopment