Including local packages from outside project root. Can we do better?
### Introduction My goal is to find a solution to include packages which reside outside of the directory tree of a project. By "project," I refer to a React Native directory that contains a `package.json` and `node_modules` generated using `npx react-native init <name>`. Consider the application and package directories as follows: ``` /home/sam/apps/my-app /home/sam/development/my-package ``` In this setup, `my-app` represents my React Native project, while `my-package` is my private UI component library. The objective is to incorporate `my-package` into `my-app`. `my-package` contains a `package.json` and some source files, typically located in the `src` directory. --- ### Why? The ability to store a package in a single location and share it across multiple projects offers a clean and efficient way to manage code. It eliminates the need to synchronize every project that utilizes the package. ### Solution and the problem A common approach to achieve this is through the use of a monorepos. However, this may not always be the most preferred solution. Curently, it appears taht employing a monorepo is the only viable option for sharing local packages between React Native projects. Another potential solution involves leveraging the `nodeModulesPaths` and/or `extraNodeModules` features of `metro.config.js`. However, these features only function partially, and I'm in the process of investigating why and hopefully devising a fix. Consider the scenario where I have my o
Posted by samsnori on Feb 16, 2024, 10:44 PM
Tags
Related issues
- Some good points here, and I definitely hate the "unalive" movement but like someone else said, it has gone beyond self-censorship to in-...
- It’s hard to take the article seriously when there’s no real discussion about how consciousness is defined and it takes Anthropic’s views...
- you know what i hate?
- > I honestly do not understand why any average person would buy anything else than a macbook today.
- Codex App frequently freezes/stutters on Windows 11 Pro despite sufficient system resources
- Add "Basic" and "Standard" plans
Raise real-world problems, find people facing the same issue, and discuss solutions.2,000 issues0 comments
ux (SaaS)
Some good points here, and I definitely hate the "unalive" movement but like someone else said, it has gone beyond self-censorship to in-...
It’s hard to take the article seriously when there’s no real discussion about how consciousness is defined and it takes Anthropic’s views...
you know what i hate?
> I honestly do not understand why any average person would buy anything else than a macbook today.
Codex App frequently freezes/stutters on Windows 11 Pro despite sufficient system resources
Add "Basic" and "Standard" plans
FEATURE: Multi-window support in Claude Code Desktop
Hi HN I built CookPal to solve a small but annoying problem for myself: I kept saving recipes from websites, TikTok, YouTube, and Instag...
Including local packages from outside project root. Can we do better?
### Introduction My goal is to find a solution to include packages which reside outside of the directory tree of a project. By "project," I refer to a React Native directory that contains a `package.json` and `node_modules` generated using `npx react-native init <name>`. Consider the application and package directories as follows: ``` /home/sam/apps/my-app /home/sam/development/my-package ``` In this setup, `my-app` represents my React Native project, while `my-package` is my private UI component library. The objective is to incorporate `my-package` into `my-app`. `my-package` contains a `package.json` and some source files, typically located in the `src` directory. --- ### Why? The ability to store a package in a single location and share it across multiple projects offers a clean and efficient way to manage code. It eliminates the need to synchronize every project that utilizes the package. ### Solution and the problem A common approach to achieve this is through the use of a monorepos. However, this may not always be the most preferred solution. Curently, it appears taht employing a monorepo is the only viable option for sharing local packages between React Native projects. Another potential solution involves leveraging the `nodeModulesPaths` and/or `extraNodeModules` features of `metro.config.js`. However, these features only function partially, and I'm in the process of investigating why and hopefully devising a fix. Consider the scenario where I have my o
Comments (0)
No comments yet. Start the discussion.