-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
"ReferenceError: URL is not defined" with html-loader v2 #1602
Comments
Thanks for reporting :) Right now this feature does not exist for the html-webpack-plugin Would you like to add a pull request for it or sponsor it's development? |
Confirmed, got the same error with images in HTML Template. |
So the reason for this bug is that we are executing the html-loader result on server side (node ssr) and therefore we run into this issue: webpack/webpack#12589 Unfortunately we don't have an absolute url as the publicPath could be:
But @alexander-akait is looking into it :) |
The core team is having a similar problem for mini-css-extract-plugin and is trying to find a good solution :) Once done I'll use the very same solution for the html-webpack-plugin |
@sokra created a pull request which allows working around the issue: webpack/webpack#12695 Once released I am quite confident that we will be able to add support for html-loader 2 |
Thank you so much for the update @jantimon ! Peace |
will be fixed with #1607 ( which requires webpack/webpack#12695 ) |
html-webpack-plugin@5.2.0 ships with html-loader support 🎉 |
Awesome greatjob @jantimon ! Thank you 😄 |
Is there a workaround for this in the meantime? |
Sorry, just updated packages and all is fine! |
Current behaviour 💣
html-webpack-plugin fails to build with html-loader v2 with option
{esModule: true}
(the default)The cause is due to
evaluateCompilationResult
does not yet passURL
to the eval context, which is newly required byhtml-loader
with{esModule: true}
. See v2 release notehtml-webpack-plugin/index.js
Line 131 in 74fae99
Expected behaviour ☀️
html-webpack-plugin builds normally.
Reproduction Example 👾
https://codesandbox.io/s/html-webpack-plugin-5x-alpha-forked-jp75v?file=/webpack.config.js
Environment 🖥
The text was updated successfully, but these errors were encountered: