Lodash Error: Named export 'isBoolean' not found.
Closed this issue · 2 comments
marcoluzi commented
Issue Summary
Since v0.9.0 I am encountering the following error when I try to run yarn prettier . --write --ignore-unknown
.
[error] Named export 'isBoolean' not found. The requested module 'lodash' is a CommonJS module, which may not support all module.exports as named exports.
[error] CommonJS modules can always be imported via the default export, for example using:
[error]
[error] import pkg from 'lodash';
[error] const { isBoolean } = pkg;
[error]
Environment
Yarn Version: v4.5.0
Node Version: v20.16.0
Prettier Version: v3.3.3
.prettierrc.js
module.exports = {
plugins: ['@zackad/prettier-plugin-twig'],
twigPrintWidth: 160,
printWidth: 160,
};
Thank you for keeping this plugin alive. :)
zackad commented
Hi @marcoluzi could you check if this #67 has fixed your issue? Either by
Link this patch into your project
# clone this repo somewhere
git clone https://github.com/zackad/prettier-plugin-twig --branch fix-import
# navigate to cloned repo
cd prettier-plugin-twig
# link custom version
yarn link
# use linked version on your project
cd PATH_TO_YOUR_PROJECT
yarn link @zackad/prettier-plugin-twig
Important
Don't forget to unlink if new version has been released
Or use git version on your package.json
"devDependencies": {
"@zackad/prettier-plugin-twig": "github:zackad/prettier-plugin-twig#fix-import",
}
Thanks.