This demo project will be named “SuzieQ”. This guide refers both to remote packages (located on the internet and probably developed by someone else than you) and local packages. It’s a side note, but “packages” as used for a developer usually refers to packages downloaded from the internet by npm or yarn. and the tools of course, npm and tsc □ Package? Local packages? I recommend to set up a in the root of the monorepo, and reference that.Each local package has it’s own configuration, such as package.json, tsconfig.json and src-folder and other (but no node_modules). One folder per local package, located in the packages folder.The monorepo itself (the root folder with it’s configuration files, like package.json, node_modules, tsconfig.json and other).Not covered by this guide: Building production builds - this guide is focused on the developer experience :) TL DR - Demo repo? from can reference local packages without errors. Running tsc in the monorepo root transpiles all packages in order.Each piece (read: local package) of the product will have its own folder with its own package.json, tsconfig.json but use the monorepo’s node_modules.There will be just one node_modules folder (in the root of the monorepo).The solution is to use a monorepo! This guide shows the step by step to manully setup a monorepo with NPM + TypeScript. Did you ever want to create one project, but with local packages? To be able to import local packages from other local packages? And the best part, to have a single node_modules directory? To have a single tsc to rebuild changed packages (but keep the others as-is)? And as a nice bonus, decrease both transpile and the time to start the program?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |