mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-24 22:09:54 -05:00
fix: Make sure afterInvoke hook doesn't get run from other plugins (#4377)
This commit is contained in:
committed by
Haoqun Jiang
parent
e6a085e96a
commit
95ca69c390
@@ -83,7 +83,9 @@ module.exports = class Generator {
|
||||
this.pm = new PackageManager({ context })
|
||||
this.imports = {}
|
||||
this.rootOptions = {}
|
||||
this.afterInvokeCbs = afterInvokeCbs
|
||||
// we don't load the passed afterInvokes yet because we want to ignore them from other plugins
|
||||
this.passedAfterInvokeCbs = afterInvokeCbs
|
||||
this.afterInvokeCbs = []
|
||||
this.afterAnyInvokeCbs = afterAnyInvokeCbs
|
||||
this.configTransforms = {}
|
||||
this.defaultConfigTransforms = defaultConfigTransforms
|
||||
@@ -130,6 +132,7 @@ module.exports = class Generator {
|
||||
const afterAnyInvokeCbsFromPlugins = this.afterAnyInvokeCbs
|
||||
|
||||
// reset hooks
|
||||
this.afterInvokeCbs = this.passedAfterInvokeCbs
|
||||
this.afterAnyInvokeCbs = []
|
||||
this.postProcessFilesCbs = []
|
||||
|
||||
@@ -142,7 +145,7 @@ module.exports = class Generator {
|
||||
if (apply.hooks) {
|
||||
// while we execute the entire `hooks` function,
|
||||
// only the `afterInvoke` hook is respected
|
||||
// because `afterAnyHooks` is already determined by the `allPluginIds` loop aboe
|
||||
// because `afterAnyHooks` is already determined by the `allPluginIds` loop above
|
||||
await apply.hooks(api, options, rootOptions, pluginIds)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user