To preprocess some custom non-HTML tags in a .vue
file, I used to be (Webpack 3) able to install a loader via a plugin that would convert those custom tags into valid html/js code before the vue loader would see them and fail.
apply(compiler) {
compiler.plugin('normal-module-factory', normalModuleFactory => {
normalModuleFactory.plugin('after-resolve', (data, callback) => {
let filename = data.resource;
// check filename
data.loaders.push({
loader: path.resolve('./my-custom-loader')
});
}
}
}
Now with Webpack 4 and the vue-loader (v15) this doesn't seem to work any more. The VueLoaderPlugin
seems to modify the rules (using what they call "pitcher") which causes my custom loader still to be called, but the changed output (the substitution of the non-html tags) doesn't seem to be passed into the vue-loader (templateLoader.js
) any more.
class VueLoaderPlugin {
apply (compiler) {
...
// replace original rules
compiler.options.module.rules = [
pitcher,
...clonedRules,
...rules
]
I haven't been able to investigate this any further than the above, so would appreciate any pointers anyone may have. In essence, I try to run my customer loader before vue-loader
to alter the .vue
files before the vue-loader gets to process them.