We had been using HtmlWebpackInlineSourcePlugin without issue but it's no longer supported so we moved to InlineChunkHtmlPlugin which works great for JS, but refuses to capture the output style.css file and inline it, leaving us with no styles.
Is there some way to inline CSS without building a crude custom solution?
There's many questions similar to mine, but all answers I've found rely on the now unmaintained HtmlWebpackInlineSourcePlugin plugin.
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
module.exports = {
// ... our other configuration options, loaders, etc
plugins: [
new CleanWebpackPlugin(pathsToClean),
new MiniCssExtractPlugin({
filename: 'style.css',
}),
new HtmlWebpackPlugin({
template: './template.html',
// inject: 'body',
inject: true,
filename: './output.html',
inlineSource: '.(js|css)$',
chunks: ['chunk'],
}),
// new HtmlWebpackInlineSourcePlugin(); // Used to work for loading JS & CSS
new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/.*/]); // Only loads JS, no CSS -- https://openbase.io/js/react-dev-utils
],
}