Skip to content

Commit

Permalink
fix: fix afterAnyInvoke hook compatibility with pnpm 4
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sodatea committed Oct 16, 2019
1 parent 953a080 commit d72b453
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/@vue/cli-plugin-eslint/generator/index.js
Expand Up @@ -106,10 +106,12 @@ module.exports = (api, { config, lintOn = [] }, _, invoking) => {
}
}

const lint = require('../lint')

module.exports.hooks = (api) => {
// lint & fix after create to ensure files adhere to chosen config
api.afterAnyInvoke(() => {
require('../lint')({ silent: true }, api)
lint({ silent: true }, api)
})
}

Expand Down

0 comments on commit d72b453

Please sign in to comment.