Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scinos/mini-css-bug-contenthash
https://github.com/scinos/mini-css-bug-contenthash
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/scinos/mini-css-bug-contenthash
- Owner: scinos
- Created: 2021-01-26T06:33:08.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-26T06:36:12.000Z (almost 4 years ago)
- Last Synced: 2024-11-05T18:03:30.371Z (about 2 months ago)
- Language: JavaScript
- Size: 32.2 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Steps to reproduce
- Run `npm install`
- Run `npm run build`
- Inspect the runtime file in `dist/runtime~main.303.43e9c511529c185ee664.js`# Example output
```
/******/ __webpack_require__.miniCssF = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "" + ({"179":"main","303":"runtime~main"}[chunkId] || chunkId) + "." + chunkId + "." + {"179":"c539139b868f46f81e90","229":"31d6cfe0d16ae931b73c","851":"31d6cfe0d16ae931b73c"}[chunkId] + ".css";
/******/ };
```# Bug 1 - Extra chunkId
`__webpack_require__.miniCssF` contains a mapping `"303":"runtime~main"`, however chunk#303 does not have a CSS file.
# Bug 2 - Extra content hashes
`__webpack_require__.miniCssF` contains mappings for `"229":"31d6cfe0d16ae931b73c"` and `"851":"31d6cfe0d16ae931b73c"`, however those chunks don't have CSS files.
# Correct output
The output should be:
```
/******/ __webpack_require__.miniCssF = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "" + ({"179":"main"}[chunkId] || chunkId) + "." + chunkId + "." + {"179":"c539139b868f46f81e90"}[chunkId] + ".css";
/******/ };
```As chunk#179 (i.e. main) is the only chunk with a CSS file, `main.179.c539139b868f46f81e90.css`
# Variations
This don't fix the problem:
```
plugins: [new MiniCssExtractPlugin({
filename: '[name].[id].[chunkhash].css',
chunkFilename: '[name].[id].[chunkhash].css',
})],
```This fixes bug#2, but not bug#1
```
plugins: [new MiniCssExtractPlugin()],
```