Fixes#4694Fixes#4695
Fix the "ENOENT: no such file or directory … debugnode_module/sms/index.js" error.
The problem are caused by 2 issues:
1. The `lint-staged` packages introduced an old version of debug,
causing node_module deduping, thus changing the node_module layout
2. The dependencies required in the cached `lint` module is no longer at
its originial position, thus the "ENOENT" error.
This change still does not fix the PNPM 4 issue, considering its smaller
user base, we'll fix it later.
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.
* fix: add pnpm v4 support
in pnpm v4 the option '--loglevel' is no longer available instead '--reporter' is used.
* refactor: remove 'v' from PNPM constants for linting
* refactor: rename variable
* fix: typo in _hasPnpm4orLater
Co-Authored-By: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
* refactor: reduce the amount of duplicate code for pnpm version check
* refactor: remove return-assignment
* refactor: add explicit return value instead of using array access
Co-Authored-By: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
* fix: remove return value from checkPnpmVersion
* fix: pnpmVersion variable
* refactor: cache pnpm version number
* refactor: fix function name and revert api break
* fix: function call correction
* refactor: export hasPnpmVersionOrLater and use this in favor of hasPnpm4OrLater
* refactor: move cache getter into getPnpmVersion
* refactor: add comment
* refactor: remove comment
BREAKING CHANGE:
The only real breaking change is https://github.com/webpack-contrib/terser-webpack-plugin/issues/129,
which is not likely to affect normal users.
The rest are default option values changes, which are already covered in
the default provided `terserOptions` of Vue CLI.
Note that here we choose to disable `extractComments` by default, as I
don't see enough data showing such license comments taking too much
space. The extra LICENSE file may also be confusing to some users.
As long as the `minimize` option is set to false (which is default in
production mode), the code won't be minimized. So the mode doesn't
matter when it comes to the `minimizer` config.
By exposing this config, users can simplify their custom config, by
removing the `process.env.NODE_ENV === 'production'` guard around their
custom minimizer configuration.