1.0.4 β€’ Published 2 hours ago

yyl-sugar-webpack-plugin v1.0.4

Weekly downloads
23
License
MIT
Repository
github
Last release
2 hours ago

yyl-sugar-webpack-plugin

USAGE

const YylSugarWebpackPlugin = require('yyl-sugar-webpack-plugin')
const wConfig = {
  plugins: [new YylSugarWebpackPlugin({ basePath: __dirname })]
}

hooks

let YylSugarWebpackPlugin
try {
  YylSugarWebpackPlugin = require('yyl-sugar-webpack-plugin')
} catch (e) {
  if (!(e instanceof Error) || e.code !== 'MODULE_NOT_FOUND') {
    throw e
  }
}

const PLUGIN_NAME = 'your_plugin'
class ExtPlugin {
  apply(compiler) {
    const IPlugin = YylSugarWebpackPlugin
    if (IPlugin) {
      compiler.hooks.compilation.tap(IPlugin.getName(), (compilation) => {
        IPlugin.getHooks(compilation).beforeSugar.tapAsync(PLUGIN_NAME, (obj, done) => {
          console.log('hooks.beforeSugar(obj, done)', 'obj:', obj)
          done(null, obj)
        })
        IPlugin.getHooks(compilation).afterSugar.tapAsync(PLUGIN_NAME, (obj, done) => {
          console.log('hooks.afterSugar(obj, done)', 'obj:', obj)
          done(null, obj)
        })

        IPlugin.getHooks(compilation).emit.tapAsync(PLUGIN_NAME, (obj, done) => {
          console.log('hooks.emit(obj, done)', 'obj:', obj)
          done(null, obj)
        })
      })
    }
  }
}

ζ–‡ζ‘£

θΏ™ι‡Œ

1.0.4

2 hours ago

1.0.3

30 days ago

1.0.2

1 month ago

1.0.1

1 month ago

1.0.0

1 month ago

0.1.14

10 months ago

0.1.13

12 months ago

0.1.12

12 months ago

0.1.11

12 months ago

0.1.10

12 months ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.9

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.0

1 year ago