Skip to content

Commit

Permalink
Document react template usage with lerna (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirjai authored and jaredpalmer committed May 30, 2019
1 parent 1f6ff56 commit 2567ff8
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion templates/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,19 @@ We recommend using https://github.com/sindresorhus/np.

## Usage with Lerna

_to be completed_
When creating a new package with TSDX within a project set up with Lerna, you might encounter a `Cannot resolve dependency` error when trying to run the `example` project. To fix that you will need to make changes to the `package.json` file _inside the `example` directory_.

The problem is that due to the nature of how dependencies are installed in Lerna projects, the aliases in the example project's `package.json` might not point to the right place, as those dependencies might have been installed in the root of your Lerna project.

Change the `alias` to point to where those packages are actually installed. This depends on the directory structure of your Lerna project, so the actual path might be different from the diff below.

```diff
"alias": {
- "react": "../node_modules/react",
- "react-dom": "../node_modules/react-dom"
+ "react": "../../../node_modules/react",
+ "react-dom": "../../../node_modules/react-dom"
},
```

An alternative to fixing this problem would be to remove aliases altogether and define the dependencies referenced as aliases as dev dependencies instead. [However, that might cause other problems.](https://github.com/palmerhq/tsdx/issues/64)

0 comments on commit 2567ff8

Please sign in to comment.