-
Notifications
You must be signed in to change notification settings - Fork 12k
angular-cli support npm linked libraries still not working #3875
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
Comments
Same as #3760, still not resolved. It does seem like an angular issue. |
Fix for angular#3875 The problem: duplication of symlinked source files (npm linked sources) in CompilerHost's stats. The solution: resolve these paths before of all Gift of kings
I had the same issue. I end doing npm pack to create a tar and then install from tar (npm install ). It worked well!! |
I should have added one additional comment regarding of the workaround, which I decided it is better than using npm link. The work around consists of the following:
Regards |
I'm not sure what's happening in your particular example. If you can get me a simple example, for instance a very basic repo that I can clone, link and see the problem, I can investigate. |
Made a reproduction repo: https://github.com/sterfpaul/angular-cli-issue-3875. Check it out and npm install and link, then run ng build and you will see the problem with angular-cli and npm link. |
Any update on this? |
Partial workaround for the problem in my repo is to add the following paths configuration to tsconfig.json:
Doesn't seem to work for everything. Not for Observable from rxjs for example. |
@sterfpaul the problem you describe is a different one than this issue proper, see #1514 (comment). |
@filipesilva It seems that it's a problem that is solvable with webpack configuration and this wasn't a problem in the <beta.21 versions. And as angular cli is generating/handling the webpack configuration this does seem like a angular cli/webpack issue not a npm issue. |
This issue, along with #1514, are notably problematic when trying to decompose a large sprawling Angular application into smaller ones. That repro from @sterfpaul is right on. Does anyone know of a possible next step for CLI to get it working for that repro? (As others have noted on this issue and elsewhere, it's possible to work around all of this with some file-watch-automatic-copy scripts; but that is messy and yields a poor development experience: extra copies of files, make sure that the right one, etc.) |
Short story : I have successfully bootstraped a working example which allow me to consume an angular library in an angular cli based app, and I can serve and build it as well. Long story : you can find it here : https://github.com/nimaen/lerna-ngcli {
"compileOnSave": false,
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2016",
"dom"
],
"baseUrl": ".",
"paths": {
"@angular/core": [
"node_modules/@angular/core"
]
}
},
"include": [
"src"
]
} Please look carefully at this tsconfig.json, since I've added the include attributes and changed the baseUrl and paths. And you will have to remove the tsconfig.app.json override rules as follow : {
"extends": "../tsconfig.json",
"exclude": [
"test.ts",
"**/*.spec.ts"
]
} |
I have a considerably larger implementation of the same pattern here: https://github.com/OasisDigital/many-to-many-angular ... with a different tsconfig paths setting, to make Rxjs and other things work:
|
I haven't had any problem with RxJS so far. |
The RxJS symptom I saw was as follows: |
The makeDecorator error happens because (possibly among other reasons) a library grabs a different copy of Angular (from its own copy of node_modules) than the application. |
I would have done the same thing with the symptoms you describe, just find it strange to not have the same error 🤔 |
@nimaen There are many errors and problems and adjustments needed as a program uses more Angular features, that are not relevant for a simple example. I am working on adding more features to my example, more modules, using more parts of the Angular API - hopefully to discover "all" of the adjustments needed for this approach to work on real, complex projects. |
Yes yes, for good. I'll have a look at your contribution for those problems 😉 |
i have similar problem with dir structure:
reproduce steps:
start demo
messy workaroundremoving path mapping inside
library dependecies:
demo dependencies:
any idea? |
I have the same problem but with Angular 5 and angular-cli 1.5.0 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OS?
Mac OSX El Capitan
Versions.
Repro steps.
The log given by the failure.
Mention any other details that might be useful.
I run into this problem this past late Summer and discovered #1875, decided to wait until it was fixed; upon noticing that it was fixed when I upgraded to [email protected] I decided to give it a whirl. Unfortunately I found the exact same problem. This time, I decided to report it.
The text was updated successfully, but these errors were encountered: