Skip to content

Loading async chunk gets error when using fullhash  #694

@zlk89

Description

@zlk89
  • Operating System: MacOS Catalina
  • Node Version: v12.16.1
  • NPM Version: 6.13.4
  • webpack Version: 5.20.2
  • mini-css-extract-plugin Version: 1.3.5

Expected Behavior

Load the website correctly

Actual Behavior

Loading it on browser, gets this error:

3ad75b68b6c11f8210e7.js:384 Uncaught (in promise) TypeError: __webpack_require__.h is not a function
    at Function.__webpack_require__.miniCssF (3ad75b68b6c11f8210e7.js:384)
    at 3ad75b68b6c11f8210e7.js:536
    at new Promise (<anonymous>)
    at loadStylesheet (3ad75b68b6c11f8210e7.js:535)
    at Object.__webpack_require__.f.miniCss (3ad75b68b6c11f8210e7.js:551)

Code

// webpack.config.js, see the reprod repo for more details
new MiniCssExtractPlugin({
    filename: '[fullhash].css',
    chunkFilename: '[fullhash].chunk.css',
})
// In index.js, load scss in a separate chunk
import('./style.css');

How Do We Reproduce?

  1. Go to this repro and branch https://github.com/zlk89/webpack-reprods/tree/mini-css-breaks-fullhash
  2. yarn install
  3. yarn start
  4. Open http://localhost:8080/ you will see the error on console

This bug only happens when you use fullhash in the css name, and async loading the css file

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions