8000 fix: fix afterAnyInvoke hook compatibility with pnpm 4 · vuejs/vue-cli@d72b453 · GitHub
[go: up one dir, main page]

Skip to content

Commit d72b453

Browse files
committed
fix: fix afterAnyInvoke hook compatibility with pnpm 4
Maybe caused by the change of resolve mechanism in pnpm 4, calling the hook from the creator would get a `Cannot find module` error. As a workaround, we now require and cache the module outside the callback function.
1 parent 953a080 commit d72b453

File tree

1 file changed

+3
-1
lines changed
  • packages/@vue/cli-plugin-eslint/generator

1 file changed

+3
-1
lines changed

packages/@vue/cli-plugin-eslint/generator/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,12 @@ module.exports = (api, { config, lintOn = [] }, _, invoking) => {
106106
}
107107
}
108108

109+
const lint = require('../lint')
110+
109111
module.exports.hooks = (api) => {
110112
// lint & fix after create to ensure files adhere to chosen config
111113
api.afterAnyInvoke(() => {
112-
require('../lint')({ silent: true }, api)
114+
lint({ silent: true }, api)
113115
})
114116
}
115117

0 commit comments

Comments
 (0)
0