You can use html-webpack-plugin. You will have to use .ejs or some other template language and then use like that
new HtmlWebpackPlugin({
template: './src/public/index.ejs',
inject: 'body',
environment: process.env.NODE_ENV
}),
in index.ejs
<body class="<%= htmlWebpackPlugin.options.environment %>">