Skip to content

Error when hot reloading preloaded stylesheet link #682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cdoublev opened this issue Jan 26, 2021 · 2 comments
Closed

Error when hot reloading preloaded stylesheet link #682

cdoublev opened this issue Jan 26, 2021 · 2 comments

Comments

@cdoublev
Copy link

  • Operating System: Debian Buster (Virtual Machine)
  • Node Version: 15.5.0
  • NPM Version: 7.3.0
  • webpack Version: 5.17.0
  • mini-css-extract-plugin Version: 1.3.4

Expected Behavior

The updated <link rel="preload stylesheet" ...> should be replaced (hot reloaded) without throwing error.

I'm not sure that a preload stylesheet link should emit a load event twice, but it happens in Chrome and Firefox. I didn't tested in other browsers.

Actual Behavior

The following error is thrown in Chrome:

Uncaught TypeError: Cannot read property 'removeChild' of null
    at HTMLLinkElement.eval (hotModuleReplacement.js:105)

The following error is thrown in Firefox:

Uncaught TypeError: el.parentNode is null
    updateCss webpack://mini-css-extract-plugin-issue/./node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js?:105
    [...]

Code

https://github.com/cdoublev/mini-css-issue

How Do We Reproduce?

Clone above repository.
Run webpack serve.
Open browser at localhost.
Update src/style.css.
Check error in the browser console.

@alexander-akait
Copy link
Member

Fixed

@cdoublev
Copy link
Author

Thank you! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants