-
-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Description
We’ve been using Lerna in Create React App, and I really like its approach. I think we should support a similar workflow (even without Lerna itself) for the “absolute paths” feature.
I imagine it working like this:
- In addition to
src, you can create a special top-level folder calledpackages. - Inside
packages, you can create folders likeapp,stuff,lol, and they all “see” each other so you can import things fromapp/whatever.jsorlol/wow.js. You can also import any packages fromsrc(but not vice versa). The entry point is stillsrc/index.js. - We won’t add any magic handling that breaks Node resolution mechanism. Instead, whenever you
npm start,npm test, ornpm run build, we will run a utility that creates symlinks fromnode_modulesof the root project to every folder inpackages. It reports a hard error if there is a conflict. This means the authors can add server rendering after ejecting without scratching their heads, and that all the tooling assuming Node resolution mechanism keeps working.
package.json
public/
src/
index.js # can import app/banana.js or harry-potter/wand.js
packages/
app/
banana.js # can import harry-potter/wand.js
harry-potter/
wand.js # can import app/banana.js
node_modules/
app -> packages/app
harry-potter -> packages/harry-potter
other-deps
Am I missing why this would be a bad idea?
axelson, EnoahNetzach, techniq, yogakurniawan, sompylasar and 21 moreAlicanC, selbekk, jjant and lukeiviesuchipi, glennreyes, crismali, hswolff, apiep and 12 more
Metadata
Metadata
Assignees
Labels
No labels