parm530
4/5/2019 - 4:22 PM

Webpack Dev Server

Webpack Dev Server

  • Used to reload changes to the page when you save your code
  • Provides a development server
  • Add this line to your package.json file within the scripts object:
"start": "webpack-dev-server --mode development --open"
  • This script will keep refreshing upon new changes made to the files
  • Need to also add: npm install html-webpack-plugin --save-dev
  • In webpack.config.js:
const HtmlWebpackPlugin = require("html-webpack-plugin");

// within the module.exports object:
plugins: [
    new HtmlWebpackPlugin({
        filename: 'index.html',
        template: './src/index.html'
    })
]
  • For the filename: option, use index.html
  • template: is our starting html file, the one you make edits to