Good read, thx for the tutorial 👍
Worth to notice, for those like me who would forget it at the begin, if you try the above HelloWorld, don’t forget to export the class otherwise the object will not be found 😉
Related error:
TypeError: HelloWorld is not a constructor
Which could be solved with a module.exports
:
class HelloWorld {
constructor(options) {
this.options = options;
}
apply(compiler) {
compiler.hooks.done.tap("HelloWorld", () => {
console.log(this.options.message);
}); }
}module.exports = HelloWorld;