[WEBPACK] 12+. Webpack : webpack-dev-server

https://www.youtube.com/watch?v=zK9ek82u_Lg&list=PLJ5qtRQovuEOqsMokakP9ue-y_jXhmCwJ&index=13

C:\Users\Administrator\Desktop\demo\webpack.config.js

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
  entry: {
    app: './src/index.js',
  },
  plugins: [
    new HtmlWebpackPlugin({
      title: 'Output Management',
      template: 'src/index.html',
      filename: 'index.html'
    })
  ],
  optimization: {
    splitChunks: {
      name: 'common'
    }
  },
  devServer: {
    contentBase: path.join(__dirname, 'dist'),
    compress: true,
    port: 9000,
    open: true
  },
  output: {
    filename: '[name].[chunkhash].js',
    path: path.resolve(__dirname, 'dist')
  }
};

C:\Users\Administrator\Desktop\demo\package.json

C:\Users\Administrator\Desktop\demo\src\index.js

C:\Users\Administrator\Desktop\demo\src\index.html

Last updated