Skip to content

fix: Make sure afterInvoke hook doesn't get run from other plugins #4377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/@vue/cli/lib/Generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -130,6 +132,7 @@ module.exports = class Generator {
const afterAnyInvokeCbsFromPlugins = this.afterAnyInvokeCbs

// reset hooks
this.afterInvokeCbs = this.passedAfterInvokeCbs
this.afterAnyInvokeCbs = []
this.postProcessFilesCbs = []

Expand All @@ -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)
}

Expand Down