plugin
webpack plugin
webpack pluginは
apply(compiler) {}
を持つクラスとして定義して、 webpack.config.jsにおいて
plugins: [ new HelloPlugin() ]
のように入れてやれば良い。
const pluginName = 'HelloPlugin'; class HelloPlugin { apply(compiler) { compiler.hooks.run.tap(pluginName, compilation => { console.log("Hello"); }); } }
hookの内容は