Tired of Typing Long Commands in Your Angular Project Run?
In real-time projects, we often face restrictions that prevent us from running simple commands like:
cmd => ng serve
Instead, we’re required to use long, complex commands like:
cmd=> "remote": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng serve -c development",
This is frustrating and time-consuming! But don’t worry—I’ve got a life hack to make it super easy!
We can define a shortcut inside package.json so we only need to type a small command instead of a long one.
Step 1: Open package.json and Add This Script
Inside the "scripts" section, add:
"remote": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng serve -c development"
Your package.json will look like this:
{
"name": "MMI-Jewel-app",
"version": "0.0.3",
"private": true,
"scripts": {
"start": "ng serve -o",
"compodoc": "npx compodoc -p tsconfig.doc.json -s -o --watch",
"remote": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng serve -c development",
"build": "ng build --configuration production"
},
}
Step 2: Run Your Command with a Simple Shortcut
Now, instead of typing that long command, just run:
cmd => npm run remote
Boom! It works like magic!
Why Use This Trick?
Saves Time – No need to type long commands daily
Reduces Errors – Avoid typos in long commands
Easy to Remember – Just run npm run remote
Boosts Productivity – Focus more on coding, less on commands
This simple yet powerful trick can make your daily workflow smoother and more efficient. Whether you’re working in a restricted environment or just want to simplify your life, this is a must-use hack!
Try it out and let me know how it works for you! Happy Coding!
Comments
Post a Comment