Angular 2 | What is Angular 2 | Cell 2 | Search

To start the Webpack development server, use the command webpack dev-server --inline --progress --port 9090.

Cell 1

%%
bash

webpack - dev - server--
inline--
progress--
port
9090

What the code could have been:

typescript
// Import the required module from the webpack package
import webpack from 'webpack';

// Define the configuration for the webpack-dev-server
const webpackConfig = {
  // Define the module for the dev-server
  devServer: {
    // Display the inline compiler output
    inline: true,
    // Display the progress bar
    progress: true,
    // Set the port for the development server
    port: 9090,
  },
};

// Check if the --mode argument is provided
if (process.argv.includes('--mode')) {
  // Set the mode for the webpack configuration
  webpackConfig.mode = process.argv[process.argv.indexOf('--mode') + 1];
}

// Create a new instance of the webpack-dev-server
const devServer = webpack.createDevServer(webpackConfig);

// Start the development server
devServer.start(() => {
  console.log('Webpack development server started on port 9090');
});

Command Breakdown