loopbackio / loopbackio/loopback-next

npm start build stuff and is too slow

Open
#7,684 4 comments 0 reactions 0 assignees View on GitHub
Build developer-experience feature
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

On a project made with the cli npm start launch the following command:

` "start": "node -r source-map-support/register .",`

This basically clean and build the full project and then start it in a dev mode.

This command can take forever to run. Azure App Service ping app and has a 230 timeout before they shutdown the container. On a small instance, the container will be shutdown before loopback has a chance to start. It's anyway a waste of ressource has Azure run build (in the build process, so no timeout) and then start (in startup script).

I belive npm start should run `"start": "node ./dist/index.js",` instead. A specific command for dev could be introduced such as `"dev": "npm run build && node -r source-map-support/register .",`.

Those are my current scripts:
```
"scripts": {
"build": "npm run clean & npm run copy-files && lb-tsc",
"build:watch": "lb-tsc --watch",
"pretest": "npm run build",
"migrate": "npm run build && node ./dist/migrate",
"openapi-spec": "npm run build && node ./dist/openapi-spec",
"dev": "npm run build && node -r source-map-support/register .",
"start": "node ./dist/index.js",
"clean": "lb-clean dist *.tsbuildinfo .eslintcache",
"copy-files": "mkdir -p dist && cp -r ./backend ./src/data ./dist"
},
```

Contributor guide

Open the contributing guide

Research direction

Start with the project’s npm scripts shown in the issue and inspect how the CLI starts from the built dist output. Make npm start launch the built entry point without rebuilding, keep a development command for build-and-run behavior, and verify both commands retain their intended roles.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
build-system, developer-experience
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.