Passing parameters to npm ci

Issue

Since the introduction of npm ci some time ago, this is the recommended way for building applications – especially for CI environments and so on.

I have now the case where I am interested in specifying additional options (e.g. the base href) when making the prod build of my Angular (9) application. The command would be:

ng build --prod --baseHref=/frontend/

What would be the counterpart when using npm ci?

I have tried:

npm ci --only=production --baseHref=/frontend/

but it seems that the additional parameters are not passed through.

Solution

npm ci only installs modules and does not invoke npm build

This command is similar to npm-install

for more information about the difference between npm i (npm install) and npm ci, refer to npm-ci documentation

this means that there is no connection to npm build and will not execute something like ng build --prod --baseHref=/frontend/

Answered By – Mr.

Answer Checked By – Terry (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.