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.

Libraries added to other Library with npm install <folder> does not compile

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Windows: 10 1709 node: v8.9.4 npm: 5.6.0 ng: 6.2.3 @angular-devkit/build-ng-packagr: 0.8.2
ng-packagr: 4.2.0

Repro steps

Create two library modules with the ng cli tool, in separate work spaces (module a and b). Build module b. Use npm to reference module b build output form module a using the folder path. (npm install <pathOtherModuleBuildOutput>.) Npm creates a symbolic link when you do this. Add module b as an import to module a. build module a.

I’ve created a small repository that reproduces the issue here https://github.com/KrauseStefan/ng-packagr-symlink-issue

The log given by the failure

Building Angular Package
Building entry point 'a'
Compiling TypeScript sources through ngc

BUILD ERROR
Error during template compile of 'NgModule'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called.
: Unexpected value 'BModule in C:/git/symlink-error/subModule/dist/b/b.d.ts' imported by the module 'AModule in C:/git/symlink-error/mainModule/projects/a/src/lib/a.module.ts'. Please add a @NgModule annotation.

Error: Error during template compile of 'NgModule'
  Function calls are not supported in decorators but 'ɵmakeDecorator' was called.
: Unexpected value 'BModule in C:/git/symlink-error/subModule/dist/b/b.d.ts' imported by the module 'AModule in C:/git/symlink-error/mainModule/projects/a/src/lib/a.module.ts'. Please add a @NgModule annotation.

    at Object.<anonymous> (C:\git\symlink-error\mainModule\node_modules\ng-packagr\lib\ngc\compile-source-files.js:40:68)
    at Generator.next (<anonymous>)
    at C:\git\symlink-error\mainModule\node_modules\ng-packagr\lib\ngc\compile-source-files.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (C:\git\symlink-error\mainModule\node_modules\ng-packagr\lib\ngc\compile-source-files.js:3:12)
    at Object.compileSourceFiles (C:\git\symlink-error\mainModule\node_modules\ng-packagr\lib\ngc\compile-source-files.js:17:12)
    at Object.<anonymous> (C:\git\symlink-error\mainModule\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:31:32)
    at Generator.next (<anonymous>)
    at C:\git\symlink-error\mainModule\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:7:71
    at new Promise (<anonymous>)

Desired functionality

Building libraries depending on other libraries through a npm install created symlink

Mention any other details that might be useful

It will be great for this to work in order to prevent excessive copying of files. I’m looking into creating a build environment where we are able to build our modules separately, I would like to maintain as fast build speeds as possible, this means that I would also like ng build --watch to still function but not be active on all modules. Symlinks with npm install <folder> is my first shot at this.

I belvie there should be a flag for library build just like there is for final browser builds, therefor I file this as a bug.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

1reaction
KrauseStefancommented, Jan 7, 2019

Thank you, I am a little embarrassed that I missed that one, thank you.

1reaction
KrauseStefancommented, Dec 12, 2018

The status is still need more information is this still the case @alan-agius4 ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

NPM doesn't install module dependencies - Stack Overflow
I found out that two of the packages needed different versions of the dependency. I resolved the conflict, removed node_modules and after a...
Read more >
Downloading and installing packages locally - npm Docs
This will create the node_modules directory in your current directory (if one doesn't exist yet) and will download the package to that directory....
Read more >
Usage of Angular libraries published to npm
The ng add Angular CLI command uses a package manager to install the library package and invokes schematics that are included in the...
Read more >
TypeScript - webpack
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. In this guide we will learn ... npm install --save-dev typescript...
Read more >
Installation – three.js docs
You can install three.js with npm and modern build tools, or get started ... the three npm module, open a terminal window in...
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