Skip to content

Commit cab1a89

Browse files
committed
Update build-file to Webpack 4 to use .hooks instead of .plugin
1 parent 0238fcd commit cab1a89

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/build-file.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ var runGitCommand = require('./helpers/run-git-command')
33
module.exports = function buildFile (compiler, gitWorkTree, command, replacePattern, asset) {
44
var data = ''
55

6-
compiler.plugin('compilation', function (compilation) {
7-
compilation.plugin('optimize-tree', function (chunks, modules, callback) {
6+
compiler.hooks.compilation.tap('compilation', (compilation) => {
7+
compilation.hooks.optimizeTree.tapAsync('optimize-tree', (chunks, modules, callback) => {
88
runGitCommand(gitWorkTree, command, function (err, res) {
99
if (err) { return callback(err) }
1010
data = res
@@ -13,12 +13,12 @@ module.exports = function buildFile (compiler, gitWorkTree, command, replacePatt
1313
})
1414
})
1515

16-
compilation.mainTemplate.plugin('asset-path', function (path) {
16+
compilation.mainTemplate.hooks.assetPath.tap('asset-path', (path) => {
1717
return path.replace(replacePattern, data)
1818
})
1919
})
2020

21-
compiler.plugin('emit', function (compilation, callback) {
21+
compiler.hooks.emit.tapAsync('emit', (compilation, callback) => {
2222
compilation.assets[asset] = {
2323
source: function () {
2424
return data

0 commit comments

Comments
 (0)