Using the watch flag in TypeScript across multiple projects - A comprehensive guide

In my project, I have the following scripts section in the package.json:

"watch": "?",
"build": "npm run build:compactor && npm run build:generator && npm run build:cleaner",
"build:lambda": "npm run build:compactor:lambda && npm run build:generator:lambda && npm run build:cleaner:lambda",
"build:compactor": "tsc -p src/compactor",
"build:generator": "tsc -p src/generator",
"build:cleaner": "tsc -p src/cleaner",
"build:compactor:lambda": "npm run build:compactor && cp package.json ./dist-compactor/package.json && cd ./dist-compactor && npm install --production && zip -r ../dist-compactor.zip *",
"build:generator:lambda": "npm run build:generator && cp package.json ./dist-generator/package.json && cd ./dist-generator && npm install --production && zip -r ../dist-compactor.zip *",
"build:cleaner:lambda": "npm run build:cleaner && cp package.json ./dist-cleaner/package.json && cd ./dist-cleaner && npm install --production && zip -r ../dist-compactor.zip *",

My project is divided into 3 subprojects, each with its own configuration file that extends the main tsconfig.json.

Running tsc -w by itself will not consider the nested configurations.

I could run tsc -p src/<project> -w concurrently 3 times, but perhaps there's a built-in way in tsc to handle this more efficiently?

Answer №1

For UNIX-based systems, a potential solution could involve running the following command in order to compile multiple TypeScript projects concurrently:

tsc -w -p project1 & tsc -w -p project2

While this method should successfully compile the TypeScript code, there is a chance that you may experience unforeseen anomalies in the console window.

Answer №2

To resolve the issue, execute the command below:

tsc -w -p project1 & tsc -w -p project2

Let me know if you need further assistance.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What could be causing the error that pops up every time I attempt to execute a git push

When I executed the following command in git git push origin <the-name-of-my-branch> I encountered the following warning message Warning: The no-use-before-declare rule is deprecated since TypeScript 2.9. Please utilize the built-in compiler check ...

Regular expression for the validation of emails using a delimiter

Can someone help me create a regex expression for emails? This is what I have so far: \S+@\S+\.\S+ I want to repeat this X times with a ; separator. Any ideas on how to achieve this? For example, the pattern should allow strings like: ...

Generate a unique Object URL for the video source by utilizing the binary string obtained from the backend

I've been facing an issue with loading binary video data from my backend using fastAPI. When I curl the endpoint and save the file, it plays perfectly fine on my laptop. For the frontend, I'm using React+Typescript. I fetch the binary video data ...

Retrieve the outermost shell of the VUEjs wrapper test-utils

While working on a VueJS test, I encountered an issue where accessing the outermost layer of HTML seemed impossible. No matter what methods I tried, the outermost layer was always ignored. Is there a way to gain access to this outermost layer so that I c ...

Exploring the benefits of using getServerSideProps with NextJS and Typescript for

Dear community, I am facing a challenge with integrating NextJS Layout and Typescript. Although everything seems to be working fine, I can't seem to get rid of the squiggly line under the props when passing them from getServerSideProps. The prop {som ...

Checking at compile time whether a TypeScript interface contains one or multiple properties

Is there a way to determine if a typescript interface contains at least one property at compile time without knowing the property names? For example, with the interfaces Cat and Dog defined as follows: export type Cat = {}; export type Dog = { barking: bo ...

TS2304 TypeScript (TS) Unable to locate the specified name

Encountering an error message stating Cannot find name 'Record'. Do I need to install a specific package for this class? Severity Code Description File Project Line Suppression State Error TS2304 (TS) Cannot find name 'Record ...

Problems with NPM Installation on Windows 7

While performing an NPM install on Windows 7, I encountered an error that I can't seem to resolve. C:\xampp\htdocs\dev4\nodejs\node_modules\jsdom\node_modules\contextify>node "C:\ Program Files (x86)& ...

Tips for fixing the issue of receiving the error message "make × ERR not found: make-$(SOURCE_FILES) when executing the npm run

I've encountered an issue while attempting to execute the command npm run build. The error message I received is: `make i info Invoking build target make i info Invoking dist/build target (node:15892) UnhandledPromiseRejectionWarning: undefined (Use ` ...

How to access an element through the router-outlet in Angular 6?

<side-navigation [navigationTitle]="navTitle"></side-navigation> <router-outlet> </router-outlet> Within my project, I have a navigation bar located in the root component. I have set up [navigationTitle] as an @Input Decorator wit ...

Show the user's chosen name in place of their actual identity during a chat

I'm facing an issue where I want to show the user's friendly name in a conversation, but it looks like the Message resource only returns the identity string as the message author. I attempted to retrieve the conversation participants, generate a ...

Unable to utilize the forEach() function on an array-like object

While I generally know how to use forEach, I recently encountered a situation that left me puzzled. Even after searching online, I couldn't find any new information that could help. I recently started delving into TypeScript due to my work with Angul ...

I am facing an issue connecting to https://registry.npmjs.org every time I attempt to download a package through npm

Operating System: Window 11 NPM version: 8.1.0 I am not using any proxy or antivirus software. Despite trying several solutions and changing registry settings, I still encounter an error when attempting to install a package using npm. I have even reinsta ...

What is the correct way to implement "next-redux-wrapper" with "Next.js", "Redux-ToolKit" and Typescript?

Currently, I am integrating RTK (redux-toolkit) into my Next.js App. I am facing an issue while trying to dispatch an AsyncThunk Action within "getInitialProps". During my research, I came across a package named "next-redux-wrapper" that allows access to t ...

Attention Needed - Certain vulnerabilities necessitate manual review for resolution

npm audit === Security Report from npm audit === # You have 1 vulnerability that can be resolved by running `npm update terser-webpack-plugin --depth 3` Severity Issue ...

What is the process for integrating npm packages with bower?

Currently, I am immersing myself in the realm of ember using a grunt/bower workflow. I have noticed that a lot of the ember extensions are available on github as npm packages. Can anyone provide guidance on the most effective approach for incorporating th ...

What is the best way to use Google Material-Design-Icons in my project once I have installed it

Once I've installed the material-design-icons package using npm, how can I incorporate them into my React application? The instructions provided here do not mention the npm method. ...

The passport.use method is failing to invoke in Node.js when utilizing the passport-local strategy

Upon calling the login and submitting the form, it seems that the use.authenticate() method is not being executed and no error messages are displayed. Server.js code snippet: const passport=require('passport'); const Strategy=require('pass ...

Generating npm package without including file extensions in imports

I am currently working on creating an internal library for my workplace. Everything seems to be going smoothly until I try to use it in another project. It appears that the file extension in all of the import statements has disappeared during the npm pack ...

Using TypeScript, you can replace multiple values within a string

Question : var str = "I have a <animal>, a <flower>, and a <car>."; In the above string, I want to replace the placeholders with Tiger, Rose, and BMW. <animal> , <flower> and <car> Please advise on the best approach ...