Skip to content

Linked package paths are not resolved correctly in 6.0.0-rc.4 #10323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Iverson opened this issue Apr 13, 2018 · 9 comments
Closed

Linked package paths are not resolved correctly in 6.0.0-rc.4 #10323

Iverson opened this issue Apr 13, 2018 · 9 comments
Assignees
Labels
needs: repro steps We cannot reproduce the issue with the information given P5 The team acknowledges the request but does not plan to address it, it remains open for discussion
Milestone

Comments

@Iverson
Copy link

Iverson commented Apr 13, 2018

Versions

Angular CLI: 6.0.0-rc.4
Node: 9.9.0
OS: darwin x64
Angular: 6.0.0-rc.4
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.5.6
@angular-devkit/build-angular     0.5.6
@angular-devkit/build-optimizer   0.5.6
@angular-devkit/core              0.5.6
@angular-devkit/schematics        0.5.6
@ngtools/json-schema              1.1.0
@ngtools/webpack                  6.0.0-rc.4
@schematics/angular               0.5.6
@schematics/update                0.5.6
rxjs                              5.6.0-forward-compat.3
typescript                        2.7.2
webpack                           4.5.0

Repro steps

  1. link some package to your Angular app, for example yarn link "@cleverdata/dmpkit"
  2. ng serve

Observed behavior

ERROR in ../cleverdata-dmpkit-common-ui/src/http/index.ts
Module build failed: Error: /Users/akrasman/work/dmpkit/cleverdata-dmpkit-common-ui/src/http/index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Users/akrasman/work/dmpkit/cleverdata-dmpkit-filemanager-ui/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:707:23)
    at plugin.done.then (/Users/akrasman/work/dmpkit/cleverdata-dmpkit-filemanager-ui/node_modules/@ngtools/webpack/src/loader.js:41:31)
    at <anonymous>

Desired behavior

Linked folders inside node_modules shouldn't crash build process like in angular-cli@1.7 with option --preserve-symlinks

@filipesilva
Copy link
Contributor

I'm not sure how this is different from #8284. It looks like you're trying to use some TS files inside your node_modules.

If you want the app to compile TS files you need to add them to the files or include property as the message says.

There is more information in #8284 (comment).

If you think that's not the case, can you provide a simple reproduction please?

@filipesilva filipesilva added this to the v6.0.0 milestone Apr 13, 2018
@filipesilva filipesilva self-assigned this Apr 13, 2018
@filipesilva filipesilva added the needs: repro steps We cannot reproduce the issue with the information given label Apr 13, 2018
@hansl
Copy link
Contributor

hansl commented Apr 13, 2018

Marking this as nice to have until we have repro steps and can assess if this is required.

@hansl hansl added the P5 The team acknowledges the request but does not plan to address it, it remains open for discussion label Apr 13, 2018
@Iverson
Copy link
Author

Iverson commented Apr 13, 2018

I'm not sure how this is different from #8284. It looks like you're trying to use some TS files inside your node_modules.

Seems like it's the same issue but the thing is that linked packages with TS files worked in CLI 1.7 and I didn't have to add node_modules/@cleverdata/dmpkit to include in tsconfig, I just used --preserve-symlinks flag.

Will it be useful if I make a repo with 2 branches (CLI 1.7 and CLI 6.0.0-rc.4) for reproducing both cases?

@Iverson
Copy link
Author

Iverson commented Apr 20, 2018

@filipesilva, I've created a demo with repro steps.

As I told before, this case worked well in CLI 1.7.3 with --preserve-symlinks flag which disappeared in 6.0.0 for some reason.

It's a very important case for development and supporting packages that you use in other angular application.

@Iverson
Copy link
Author

Iverson commented Apr 23, 2018

Well, I found out that --preserve-symlinks flag is still available for ng build command, what is more, my demo builds correctly when I use ng build --preserve-symlinks. Therefore, if we could return --preserve-symlinks for ng serve command it would resolve a problem.

@filipesilva
Copy link
Contributor

@Iverson if your app needs --preserve-symlinks to build properly, then you should set it in your angular.json for it to always be used.

You can set it in this section:

      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "preserveSymlinks": true

This way it will always be used, without needing to use the flag every time.

@Iverson
Copy link
Author

Iverson commented May 2, 2018

@filipesilva, thank you! It works.

@elclanrs
Copy link

elclanrs commented May 8, 2018

@filipesilva this option doesn't seem to be available anymore in 6.0.0 with ng serve, although it still works when configured in angular.json. Any chance of bringing back the option in the cli?

@angular-automatic-lock-bot
Copy link

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

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: repro steps We cannot reproduce the issue with the information given P5 The team acknowledges the request but does not plan to address it, it remains open for discussion
Projects
None yet
Development

No branches or pull requests

4 participants