Frontend
plugin|Writing a Plugin
webpack dev server 自定義訊息顯示
webpack dev server 自定義訊息顯示
class TestPlugin { constructor (options) { this.info = options.info || {} }
apply (compiler) { compiler.hooks.done.tap('Show something', () => console.log(this.info)) }}module.exports = TestPluginconst TestPlugin = require('./TestPlugin')module.exports = { // ... configureWebpack: { plugins: [ new TestPlugin({ info: 'Piece of shit' ] }}npm run server後就會顯示info 所帶入的訊息