-
Notifications
You must be signed in to change notification settings - Fork 12k
ng serve - npm linked library changes(updates) are not reflected in UI #6195
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
The reproduction of this issue is highly dependent on the build process you're using for your library. Can you provide a runnable repro we can look at? |
I do have kind of a similar problem and tried to create a simple example that hightlights it. Libraries used:
Dev Environment:
Projects used:
Steps to reproduce: In angular-library:
In cli-project
Open App in Browser - you should see "Sample component 2" as the second heading. Go back to the angular-library project.
It is getting recompiled directly by gulp, the dist folder is updated correctly. Expected behaviour: |
Fun fact: Cannot reproduce on macOS Sierra 10.12.4 |
Was able to reproduce using the @joachimprinzbach 's projects on: Interestingly enough though: |
I recently started using the cli on windows, I'm having the same problem, to the point that I have to restart the server every other change. Fun fact, this doesn't happen on Mac |
Hey I think I know what's going on... that generator was based on a WIP starter of mine (https://github.com/filipesilva/angular-quickstart-lib), and I ran into this problem last week while making the linked lib docs (#6292). Turns out you cannot delete I opened an issue in jvandemo/generator-angular2-library#91 to have it fixed. Also, big kudos to @joachimprinzbach for the awesome repro. Once I saw the setup I instantly knew what was going on. Detailed repros rock 🤘 |
@filipesilva I have also seen that problem when I deleted the dist folder. The cli recognizes the change and the build brakes. This is a bug in the generator. However, if you follow my steps in the same order as mentioned (build the library first, then start the watch task) - the problem is different. The library content gets correctly updated in the apps node_modules folder, the link works just fine. The only problem is, that the cli does not recognize the change. No recompilation happens, not even an error. The webpack-dev-server might be the problem? |
@joachimprinzbach are you sure it's different? The |
You're right, something else is at play here. I followed everything and could see a refresh, node_modules content would reflect it, but the webpage would not change. I also saw an error after a bunch of refreshes:
|
I think this this is caused by several files being deleted and regenerated at the same time. If you delete Now I'm not sure this is a CLI/Webpack problem. Is it reasonable to expect the build system to figure out that deleted JS modules are going to come back in a split second? Maybe it is reasonable, and this problem has already been solved in Webpack somehow. Or maybe Webpack cannot deal with this. I don't know at the moment. |
@TheLarkInn: Hey Sean, ever seen something like this? |
@filipesilva, @joachimprinzbach — Just fo confirm that I am seeing the same behavior here (on Mac). Setup:
Scenario:
Learnings so far:
I will perform some additional research before work later this week 👍 |
Hm, I wonder why some users didn't see it in OSX then... and I should add that for me, on Windows, |
I had similar issue with angular/cli 1.0.6. -update were not always reflected what worked for me was downgrading to version angular/[email protected] i would recommend trying different service releases out the find a good working match of different libs.
|
hi, does anyone have a solution for this problem? I have the same issue here. Working on This problem has obviously nothing to do with @jvandemo generator (great work btw). try add a new method / property to a services, provided by a dependency lib linked to your cli-project, while both build-chains are listening for changes. Method 'doSomething' does not exist on type 'MyService' if you Can anyone reproduce this? |
hi tom,
which editor are you using?
Am 23.06.2017 16:30 schrieb "Tom" <[email protected]>:
… hi, does anyone have a solution for this problem?
I have the same issue here. Working on
macOS Sierra 10.12.5.
@***@***.***
node v8.1.2
This problem has obviously nothing to do with @jvandemo
<https://github.com/jvandemo> generator (great work btw).
try add a new method / property to a services, provided by a dependency
lib linked to your cli-project, while both build-chains are listening for
changes.
dependency lib and cli project will rebuild as expected but if you try to
call this new method within the cli-project it will crash.
Method 'doSomething' does not exist on type 'MyService'
if you ng serve the cli-project again it works.
Can anyone reproduce this?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6195 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APx6Y2JE9baoh-qDxUgvRbPBrqvO3Xc0ks5sG8wAgaJpZM4NR67M>
.
|
VS Code Version 1.13.1 |
hi,
I think the cause can be vs code editor. Can you try to make changes with
the normal textedit and look if the changes get updated?
vs code has its own build in file watch mechanism and this can be likely to
clash with webpack's filewatch.
2017-06-24 0:28 GMT+02:00 Tom <[email protected]>:
… VS Code Version 1.13.1
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6195 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APx6Y8ZIxamd782Mnd3ttxXjQnoJ0En7ks5sHDwdgaJpZM4NR67M>
.
|
nice idea, but no, same behaviour if i use vim to edit my dependency lib. what i also learned is that i can change property values or remove methods of a service provided by a linked dependency lib. But if i add new stuff, a new property for example, then my ng-cli app doesn't know about it. unless i restart the build process. |
@synctom did you ever find a solution to this? We are seeing the same issue in our project but can't pinpoint the cause. |
Same issue here, using npm-linked module in an angular app. The module is a plain typescript module with no angular dependencies. It uses Repro steps:
File under Stopping |
hi @tanyagray, unfortunately the issue still remains. angular cli is utilizing webpack to resolve module dependencies and build bundles. i believe the problem is somewhere in there. In addition, the title of this issue is kind of misleading. looks like some kind of caching issue during module resolution. |
I have tried the solution of @sunew exactly step by step (on Windows, with @julien-arhs @ebrehault Do you also use Mac like @sebastian-man ? Is it just a Windows thing? |
I use a Mac os 10.12.6.
|
For me, it works on MacOSX and Ubuntu. |
@julien-arhs I have defined --preserve-symlinks in the angular-cli.json. @ebrehault Thanks. |
Both methods worked for me. But the npm link method to link the library in the /node-modules folder of the project is the better way to do it imo. As said by @sebastian-man :
|
@julien-arhs What does "worked for me" means in your case? Just to consume the library in the CLI App? Or even more the code refresh when library code changes when running the CLI app with ng serve? |
Also the code refresh.
|
Windows:10, Library generated by generator-angular2-library. Linked dist dir inside lib using npm.
I then ejected webpack from cli 1.4.2 setup using ng eject. ngtools/[email protected] works. I cannot figure out what has changed between ngtools/webpack 1.6.0-rc5 and 1.6.0 ? I am using cli 1.2.7 for now. |
After spending some time investigating this issue I found the following solution for linking angular libs by source. Some has already been outlined above but this is the summary:
This should fix the compilation errors. You may notice that during It is not ideal as you need to hardcode paths to the tsconfig.json file but its the best solution i could find apart from messing around with copying lib code into the source tree or using external commands to manage links/junctions. |
What works for me is to consume the library when compiled separately by My solution is implemented in my own experimental library packager |
Can you still reproduce this issue? |
Little late for the party, but... if anyone still has issues of that kind, try angular cli. And yes, also supports watch mode out of the box. learn more: |
Yeah I remembered watching this ticket when I had to build external libraries with a third party tool like |
I am using new angular cli and library schematics, but still can reproduce the issue((( |
@ToniaDemchuk did you enable resource-inlining in tsconfig.lib.json?
|
@synctom Yes, I did |
Can you kindly provide the output of |
Angular CLI: 7.1.4 Package Version@angular-devkit/architect 0.11.4 |
I'm sorry, but we can't reproduce the problem. Remember that we have a large number of issues to resolve, and have only a limited amount of time to reproduce your issue. If the problem persists, please open a new issue following our submission guidelines. A good way to make a minimal repro is to create a new app via |
😃 I was able to solve my issue. I'm not using any npm/yarn/lerna linked packages. Instead I'm just using tsconfig.json File Structure:
tsconfig files:
I'm on Angular 7. |
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. |
Bug Report or Feature Request (mark with an
x
)Versions.
@angular/cli: 1.0.1
node: 6.10.1
os: darwin x64
@angular/common: 4.1.1
@angular/core: 4.1.1
@angular/forms: 4.1.1
@angular/http: 4.1.1
@angular/platform-browser: 4.1.1
@angular/platform-browser-dynamic: 4.1.1
@angular/router: 4.1.1
@angular/cli: 1.0.1
@angular/compiler: 4.1.1
@angular/compiler-cli: 4.1.1
macOs Sierra 10.12.4
Node: v6.10.1
Npm: 3.10.10
Repro steps.
Since this dist folder it's linked with node_modules one in my angular project 'myProject' for every build the package is update.
The log given by the failure.
Doesn't update UI on changes.
Desired functionality.
When the library (etc - in our case) it's compiled along with it's resources, the angular-cli project should see the changes and update the UI. Eg: external html templates and css - not updated.
Mention any other details that might be useful.
--
Question is, anything can be done or need create a separate watch script to support both the library and myProject?
The text was updated successfully, but these errors were encountered: