incorrect `projectRoot` when using parcel in monorepo
See original GitHub issue🐛 bug report
I’m using lerna with yarn workspace just like you guys do.
When I run parcel within a sub package, it can’t read the .env
.proxyrc.js
files inside the package, instead it reads them from the root of repo.
After digging into the code, turns out that projectRoot
was set incorrectly, and there is no way to specify its value. Here is the code in @parcel/core
https://github.com/parcel-bundler/parcel/blob/v2/packages/core/core/src/resolveOptions.js#L52-L61
🎛 Configuration
with all default Configurations
🤔 Expected Behavior
parcel can reads configurations inside the sub package
😯 Current Behavior
parcel reads configurations from the root of repo
🔦 Context
possible solutions:
- change parcel behavior in monorepo
- add an option
--project-root
(projectRoot
in API) to allow user to specifyprojectRoot
🌍 Your Environment
Software | Version(s) |
---|---|
Parcel | 2.2.1 |
Node | v16.9.1 |
npm/Yarn | yarn 1.22.11 / npm 7.21.1 |
Operating System | macOS 12.1 |
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Setup a Monorepo with PNPM workspaces and speed it up ...
In this article we're going to have a deep dive into setting up a new monorepo using PNPM workspaces that hosts a Remix...
Read more >Dependency resolution | Parcel 中文网
As Parcel builds your source code, it discovers dependencies, which allow code to be broken into separate files and reused in multiple places....
Read more >Parcel
Parcel combines a great out-of-the-box development experience with a scalable ... You can even build a whole monorepo of packages in a single...
Read more >The Ultimate Guide to TypeScript Monorepos
Tagged with typescript, javascript, programming, yarn. ... file in the project root and that will apply to all files in the Monorepo.
Read more >We abandoned npm install, maybe you should too - Medium
As I'm sure you already know, monorepos are awesome! If you don't know, a monorepo is a repository with multiple applications and libraries, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Adding an empty
pnpm-lock.yaml
(or any lockfile) file to a subpackage of the monorepo fakes theprojectRoot
directory of Parcel.Note that Parcel doesn’t watch anything outside the package root. So moving it somewhere inside of the monorepo will not watch other packages you might import from the monorepo.