Automattic / Automattic/newspack-scripts

Resolving `prettier` dependency

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Due to issue with dependency resolving, you might end up a different version of `prettier` in project's `node_modules` and `node_modules/newspack-scripts/node_modules`.
To fix this and make `newspack-scripts` use to "root" version of `prettier`, remove the offending `prettier` version in a `postinstall` hook script:

```json
"postinstall": "rm -rf node_modules/newspack-scripts/node_modules/prettier"
```

---

This might be caused by version resolving being thrown off by aliasing `prettier` to [`wp-prettier`](https://www.npmjs.com/package/wp-prettier) as `npm:wp-prettier@2.2.1-beta-1`.

Technically it seems like the [`overrides` option](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides) should take care of that, but I did not have any luck with using it.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.