Closed
Description
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 config
Code:
const HtmlWebpackPlugin = require("html-webpack-plugin");
const VueLoaderPlugin = require("vue-loader/lib/plugin");
module.exports = {
module: {
rules: [
{
test: /\.vue$/,
loader: "vue-loader"
}
]
},
plugins: [
new VueLoaderPlugin(),
new HtmlWebpackPlugin()
]
};
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:
Error: Child compilation failed:\n' +
" Cannot read property 'slice' of undefined\n" +
" TypeError: Cannot read property 'slice' of undefined\n" +
' \n' +
' - plugin-webpack5.js:123 Object.resourceQuery [as fn]\n'
+
' [platform]/[vue-loader]/lib/plugin-webpack5.js:123:39\n
' +
' \n' +
' - RuleSetCompiler.js:99 execRule\n' +
' [platform]/[webpack]/lib/rules/RuleSetCompiler.js:99:21
So it looks like query
is empty in
vue-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 of compilation
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-sjbcq
Metadata
Metadata
Assignees
Labels
No labels