I have a vue2 component that looks like this:
<template>
<p>Hello world</p>
</template>
<script>
export default { name: 'Example' };
</script>
<docs>
Some documentation...
</docs>
I also want to use an additional loader for my vue files, so my webpack config looks like this:
module.exports = {
module: {
rules: [{
test: /\.vue$/,
use: [{
loader: 'vue-loader',
}, {
loader: path.resolve(__dirname, 'CustomLoader.js'),
}],
}],
},
};
with
// CustomLoader.js
module.exports = function(source) {
return source;
}
Running webpack bundle throws an error that it's missing a loader for the <docs> block, even though the CustomLoader returns the source code unchanged. Something along the lines of:
Error in path/to/component.vue?vue&type=custom&index=0&blockType=docs
Module parse failed: Unexpected token
File was processed with these loaders:
* ./node_modules/vue-loader/lib.index.js
* ./CustomLoader.js
You may need an additional loader to handle the result of these loaders.
Removing either of
- the
CustomLoader - the
<docs>tag solves the issue.
Can anyone tell me what the problem is?