Open
Description
Description
In a project using yarn 3.6.3 in pnp mode, I'm not able to use husky + lint-staged as pre-commit hook.
My .yarnrc.yml file:
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
pnpEnableEsmLoader: true
yarnPath: .yarn/releases/yarn-3.6.3.cjs
Relevant section in package.json
...
"scripts": {
...
"postinstall": "husky install"
},
"lint-staged": {
"*.{js,jsx}": [
"eslint --fix",
"prettier --write"
],
"*": "prettier --ignore-unknown --write"
},
...
Steps to reproduce
Create an application based on yarn 3 + pnp mode, add lint-staged, configure it and then run
yarn run lint-staged
Debug Logs
expand to view
[PATH TO MY APP]/.yarn/cache/lint-staged-npm-14.0.1-50e37043be-8c5d740cb3.zip/node_modules/lint-staged/lib/loadConfig.js:4
import { lilconfig } from 'lilconfig'
^^^^^^^^^
SyntaxError: Named export 'lilconfig' not found. The requested module 'lilconfig' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'lilconfig';
const { lilconfig } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:122:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:188:5)
at async CustomizedModuleLoader.import (node:internal/modules/esm/loader:228:24)
at async loadESM (node:internal/process/esm_loader:40:7)
at async handleMainPromise (node:internal/modules/run_main:66:12)
Node.js v20.5.1
Environment
- OS: macOS Ventura 13.5.1
- Node.js: 20.5.1
lint-staged
: 14.0.1
Metadata
Metadata
Assignees
Labels
No labels
Activity