Webpack launch browser automatically

前端 未结 9 942
遥遥无期
遥遥无期 2021-02-03 17:18

Gulp + live reload serves up my content on localhost and (here\'s what I\'m after) launches the browser automatically at the server url whenever i run the gulp

9条回答
  •  别跟我提以往
    2021-02-03 18:02

    You can configure devServer

    const merge = require('webpack-merge');
    const common = require('./webpack.base.config.js');
    const path = require('path');
    
    module.exports = merge(common, {
      mode: 'development',
      devServer: {
        contentBase: path.join(__dirname, 'dist'),
        port: 3000,
        hot:true,
        compress: true,
        open:"Chrome",
        openPage:'index.html'
      },
    });
    

提交回复
热议问题