# Yarn Workspaces

Nodewood makes heavy use of Yarn's Workspaces feature (opens new window). Workspaces are a feature that make it much easier to use a monorepo (opens new window) project layout. Nodewood primarily uses it to allow the wood folder and the app folder to maintain their own list of JavaScript packages.

This means that when an updated Nodewood installation (wood folder) includes new or changed packages, only the package.json file in wood is changed. The package.json file in app is unchanged, so you never have to worry that an update to Nodewood will clobber one of your packages, or conversely, an update to one of your packages will cause a Nodewood dependency to stop working.

# Using Workspaces

Always install packages in the app folder. This will add those packages to app/package.json, and keep them separate from Nodewood's packages (which live in wood/package.json) or environment/development packages (which live in ./package.json).

Run yarn install from your project root. This will install all packages from all three above-mentioned package.json files into node_modules in the project root. Any shared packages (at shared versions) will get linked to the same folder, saving hard drive space.

# A Note About Ejected Files

If you use Nodewood's eject command to create an app copy of a wood file, and you get an error while compiling that a certain library cannot be found, that simply means that it does not exist in the app/package.json. When the file was being loaded from wood, it was using wood/package.json, which did not cause an error.

To fix this, simply copy the line for the package from wood/package.json to app/package.json, run yarn install and restart nodewood dev.