All my code runs twice when compiled by Webpack

前端 未结 2 827
眼角桃花
眼角桃花 2020-12-08 20:35

When I build my js bundle with webpack using webpack-dev-server my code runs twice every time. Not sure how to fix it.

Screenshot of Developer Tools con

2条回答
  •  盖世英雄少女心
    2020-12-08 20:51

    in the template file you might have manually added a loading the bundle.

    If you don't have the

    inject: false 
    

    option in

    new HtmlWebpackPlugin({
        template: path.join(__dirname, '../src/index.html')
    }),
    

    the bundle will get added again.

提交回复
热议问题