question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ng packagr does not remove devDependencies

See original GitHub issue

Type of Issue

[ X ] Bug Report
[ ] Feature Request

Description

ng-packagr 4.0.1

A bug: please describe the error that you encountered

  • ng-packagr copies devDependencies to the final package.json even though they are not whitelisted.

  • i have angular in peerDependencies and devDependencies

  • as a consequence i get an invalid “package” (i.e. npm link will install all those dependencies…)

  • building an app with a linked library will not work

  • the following error happens, because angular core is now referenced twice

ERROR in ../@foo/bar/foo-bar.ts(9,2): Error during template compile of 'FoobarModule'

  Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'NgModule'

    'NgModule' calls 'ɵmakeDecorator'.

node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.

node_modules/@foo/bar/node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.

Expected Behaviour

A bug: please describe what behaviour or result you expected

  • devDependencies should not be copied by default and only when they are whitelisted

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr: 4.0.1
@angular/*: 6.1.0
typescript: 2.7.2
rxjs: 6.2.2
node: 8.11.3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
CarstenLeuecommented, Mar 11, 2019

@alan-agius4 independent of the discussion how npm link works, is there any usecase for including devDependencies in a package published to npm?

If not, I would second the request to remove devDependencies from the generated package.json, automatically (just as scripts are removed)

0reactions
alan-agius4commented, Dec 21, 2022

Closing as this is not planned.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove dependency completely from Npm - Stack Overflow
So if you would like to remove dependencies this is where you start. remove them from package.json and run npm prune .
Read more >
ng-packagr/ng-package.schema.json - UNPKG
The CDN for ng-packagr. ... ng-packagr/ng-package.schema.json ... list of dependencies that are allowed in the 'dependencies' and 'devDependencies' section ...
Read more >
ng-packagr - npm
Start using ng-packagr in your project by running `npm i ng-packagr`. There are 386 other projects in the npm registry using ng-packagr.
Read more >
Heroku Node.js Support
If you're not using npm install , you can go ahead and disable the ... If you need access to packages declared under...
Read more >
How to clean up node modules? | by Mario Kandut - Medium
Extraneous packages are those present in the node_modules folder, but not listed as any ... the packages specified in your devDependencies will be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found