Bug: asset relocation doesn't work with yarn monorepos because `filterAssetBase` is set to `cwd`
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 9.8k
- Forks
- 326
- PR merge metrics
- No merged PRs in 30d
Description
Steps to reproduce:
- have a yarn workspaces monorepo
- have 2 packages in the monorepo
- package A has an asset dependency
- package B uses package A
- build package B with ncc
Expected result:
- the asset is relocated
Actual result:
- the asset is not relocated because
filterAssetBaseis set tocwdand the two packages are symlinked
My workaround:
- the build script changes directory to root package before building
Proposed solution:
- I don't understand why
filterAssetBaseshould be set to anything other than/. Why does it matter where the asset is located? if it's referenced in original code, it should be relocated. SofilterAssetBaseshould be set to/ - (this is related) There are many options exposed by
nccin javascript but not via the cli command. Have a jest/webpack style configuration javascript file, that would export all the properties in thenccinterface. This object would be merged to override the default configuration passed bycli.js.
I can create a PR that would address these two issues if I get the green light from you (the maintainers)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Yarn workspaces case described, then trace how filterAssetBase is set and used during asset relocation. Read cli.js to see how ncc options are passed, and verify that building package B relocates package A's asset; treat the proposed JavaScript configuration file as a separate scope decision.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100