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.

Use Angular CLI and ng-packagr for local development and CI servers

See original GitHub issue

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

Not sure the packagr is actually compatible with the cli in the same repo as described in the readme. I realize that this issue is related to another repo, but this was the only place to file an issue. I believe it is related to how the cli resolves modules slightly differently than tsc (at least for modules outside the baseUrl).

How To Reproduce

When attempting to use the repo from the readme, the ng serve command fails with ERROR in src/app/app.component.ts(3,28): error TS2307: Cannot find module '@my/lib'. src/app/app.module.ts(7,29): error TS2307: Cannot find module '@my/lib'.

Expected Behaviour

It should be able to resolve lib

Version Information

  "dependencies": {
    "@angular/common": "~5.0.0",
    "@angular/compiler": "~5.0.0",
    "@angular/core": "~5.0.0",
    "@angular/forms": "~5.0.0",
    "@angular/http": "~5.0.0",
    "@angular/platform-browser": "~5.0.0",
    "@angular/platform-browser-dynamic": "~5.0.0",
    "@angular/router": "~5.0.0",
    "core-js": "^2.4.1",
    "rxjs": "^5.4.2",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "1.5.0",
    "@angular/compiler-cli": "~5.0.0",
    "@angular/language-service": "~5.0.0",
    "@types/jasmine": "~2.6.0",
    "@types/node": "~8.0.0",
    "codelyzer": "~4.0.0",
    "cpr": "^3.0.0",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.3.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "ng-packagr": "1.5.0",
    "protractor": "~5.2.0",
    "rimraf": "^2.6.1",
    "ts-node": "~3.3.0",
    "tslint": "~5.8.0",
    "typescript": "~2.5.2"
  }

Update: For anyone else facing this issue, I believe it is being tracked here in the cli project and has been assigned to someone. - https://github.com/angular/angular-cli/issues/8308 Seems it is looking in node_modules to module resolution and ignoring all other path settings and alias’ such as those in tsconfig or webpack (according to the issue).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dhergescommented, Nov 10, 2017

@jonesmac Exactly! More of a general rewrite of the README how you used the demo project. That will be super-cool!

0reactions
github-actions[bot]commented, Jun 19, 2020

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting up the local environment and workspace - Angular
This guide explains how to set up your environment for Angular development using the Angular CLI tool. It includes information about prerequisites, ...
Read more >
CLI Overview and Command Reference - Angular
In your browser, open http://localhost:4200/ to see the new application run. When you use the ng serve command to build an application and...
Read more >
Creating libraries - Angular
Angular CLI uses a tool called ng-packagr to create packages from your compiled code that can be published to npm. See Building libraries...
Read more >
ng build - Angular
Option Description Value Type Default Value ‑‑aot Build using Ahead of Time compilation. boolean true ‑‑base‑href Base url for the application being built. string ‑‑delete‑output‑path Delete...
Read more >
Deployment - Angular
During development, you typically use the ng serve command to build, watch, and serve the application from local memory, using webpack-dev-server.
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