jantimon / jantimon/html-webpack-plugin

About v5 version js will be inserted in front of css by default

Open
#1,782 3 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
JavaScript
Stars
10.7k
Forks
1.3k
Avg merge
1m
Merged PRs (30d)
1

Description

Hello, when we upgraded from v4 to v5, we found that the default location for inserting js has changed. Can you tell me why this change was made

v4:
![image](https://user-images.githubusercontent.com/32671774/217413529-796fe3d4-67a3-4d25-9620-dfe0fe40e732.png)
v5:
![image](https://user-images.githubusercontent.com/32671774/217413655-723453dc-a829-4d53-9864-c01ab24f4ed1.png)
webpack config:
`const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = {
mode: "production",
entry: ["./src/index.js"],
output: {
filename: "[name].[hash:8].js",
clean: true,
},
module: {
rules: [
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"],
exclude: /node_modules/,
},
{
test: /\.js$/,
use: ["babel-loader"],
exclude: /node_modules/,
},
],
},
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: "vendors",
chunks: "all",
},
},
},
},
plugins: [
new HtmlWebpackPlugin(),
new MiniCssExtractPlugin(),
],
};
`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided webpack configuration and reproduce the v4-to-v5 upgrade using HtmlWebpackPlugin and MiniCssExtractPlugin. Compare the generated HTML and review the plugin behavior responsible for asset insertion order. Done means explaining the change from v4, or identifying a confirmed regression with a focused reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.