ts-monorepo | Template for setting up a TypeScript monorepo | Frontend Framework library
kandi X-RAY | ts-monorepo Summary
kandi X-RAY | ts-monorepo Summary
Template project for setting up a TypeScript monorepo.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ts-monorepo
ts-monorepo Key Features
ts-monorepo Examples and Code Snippets
Community Discussions
Trending Discussions on ts-monorepo
QUESTION
Given a monorepo project.
--project_root/
|--packageA/
|--index.ts
|--package.json
|--foo/
|--index.ts
|--packageB/
|--index.ts
|--package.json
|--bar/
|--spam.ts
Normally, when you are in packageA/index.ts
and you want to import packageB/index.ts
you would do import index from '../packageB'
,
and when you are packageA/foo/index.ts
and you want to import packageB/index.ts
you need to move two directory up import index from '../../packageB'
The question is, is there a way to import like import index from 'packageB
and for nested folder import spam from 'packageB/bar/spam'
?
EDIT
I have uploaded a github repo to demo the issue https://github.com/jaimesangcap/lerna-ts-monorepo
...ANSWER
Answered 2018-Nov-22 at 08:31You can do this by specifing the base url and (in more complicated cases) by using path mapping.
If you have a tsconfig.json
in project_root
, you can achieve the desired import strategy by defining
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ts-monorepo
yarn workspaces
npm 7 workspaces
npm < 7 and lerna bootstrap
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page