-
Notifications
You must be signed in to change notification settings - Fork 915
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
vue-loader crashes build if used together with html-webpack-plugin@next #1771
Comments
A quick debugging shows that this line triggers it: jantimon/html-webpack-plugin@0cd156c#diff-22815e8839560dd9537e55a071392863103a6e02ed6f6d2580ed779e8296e012R117 |
@sodatea correct - maybe the vue-loader doesn't work well with the new webpack 5 |
@sodatea I could reproduce the bug without the html-webpack-plugin: const VueLoaderPlugin = require("vue-loader/lib/plugin");
module.exports = {
entry: {
main: 'data:text/javascript,console.log("hello world");'
},
module: {
rules: [
{
test: /\.vue$/,
loader: "vue-loader"
}
]
},
plugins: [new VueLoaderPlugin()]
};
here is a new codesandbox: https://codesandbox.io/s/vue-loader-inline-script-wbfcz?file=/webpack.config.js |
🤔 The newly added This is in contradiction with webpack's type declarations https://github.com/webpack/webpack/blob/10ad4e95b850bbe20019275fd1d364666c4b69ea/declarations/WebpackOptions.d.ts#L243 It's easy to work around this issue in vue-loader though, so I'd like to ship a quick fix anyway. |
Thanks @sodatea 👍 In that case should we create a ticket for webpack/webpack ? |
Yeah I think so |
Done: webpack/webpack#12214 |
in webpack/webpack#12214 @sokra explains why he would prefer to keep the current behaviour and to adjust the typings in webpack - could you please add support for |
Cool thanks @sodatea 👍 |
Version
vue-loader: 16.1.1
html-webpack-plugin:
5.0.0-alpha.17
Reproduction link
https://codesandbox.io/s/html-webpack-plugin-5x-alpha-vue-6n1ub?file=/webpack.config.js:0-360
Steps to reproduce
Install the
[email protected]
and run the following webpack configCode:
What is happening?
I am not even using a
.vue
file in my project but the loader is kicking in and crashes the child compilation of the html-webpack-plugin with the following trace:So it looks like
query
is empty invue-loader/lib/plugin-webpack5.js
Line 123 in 7402077
Any idea why the vue-loader is having issues here?
It worked fine with
[email protected]
Maybe using
thisCompilation
instead ofcompilation
could fix it:vue-loader/lib/plugin-webpack5.js
Line 35 in 7402077
However switching to
thisCompilation
might break the vue file compilation in childcompilers e.g. for ssr in the html-webpack-plugin similar to this react jsx example: https://codesandbox.io/s/html-webpack-plugin--jsx-sjbcqThe text was updated successfully, but these errors were encountered: