-
Notifications
You must be signed in to change notification settings - Fork 12k
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
feat(webpackDevServer): Add watchOptions for webpackDevServer #1814
Conversation
In cases where Angular CLI is running in a shared directory on linux VM on a windows host the webpack dev server isn't detecting file changes from the host environment. (ex: Whenever a docker dev environment is running on a windows host.) With this change the following can be added to the defaults object in angular-cli.json to change the default polling option:
When the Here is the link to the webpack docks regarding watchOptions.poll: Note: Also removed 4 out of the 5 blank lines at the end of the file that I'm assuming shouldn't be there. Edit: Update change required for angular-cli.json |
Minor edit. instead of making all watchOptions configurable only make |
rebased to master |
restarting travis |
Hi All, The recent changes to config broke the change I made. I'm looking into it. |
64904fc
to
b9ad5e1
Compare
You need to update the schema JSON, not the |
@hansl should it be in both or just the schema? As stated previously, without the change there's no direct way to have webpack detect changes on shared directories between linux/windows via a VM such as in docker development environments. With the common "poll" flag option in defaults it can be applied to other addons which may want to conditionally add polling for detecting file changes. Please let me know if anything else is needed. |
Another note on polling, this may also resolve the watch issues for users developing in Window's 10's Ubuntu Usermode, I haven't tested that myself though. Reference |
bd0fbff
to
350b667
Compare
@@ -138,6 +138,9 @@ | |||
}, | |||
"lazyRoutePrefix": { | |||
"type": "string" | |||
}, | |||
"poll": { | |||
"type": [ "boolean", "number" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ends up causing a warning in SchemaClassFactory._createChildProperty when doing an ng serve
because the function isn't built to handle a field that can be of more than one type. The example "type": [ "boolean", "number" ]
is valid JSON Schema per http://jsonschemalint.com/draft5/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that in a163186 the custom-typings.d.ts file defined poll
as only being a number
. I've updated all of my poll
definitions to reflect this.
369f016
to
828ef20
Compare
I've updated this PR to reflect the typing decision made in a163186 to define the |
8ed0c62
to
5b301df
Compare
Having this will also allow docker users to setup the toolchain and support the watched building. I'd love to see this get merged. |
7bf6734
to
cc16467
Compare
With angular#1814 the `defaults.poll` option was added to the cli config. This setting won't be applied to the karma defaults without this update.
…r#1814) Add watchOptions to webpackDevServerConfiguration to conditionally enable polling option in watchpack Remove additional blank lines from end of serve-watchpack.ts so that only one is remaining
With angular#1814 the `defaults.poll` option was added to the cli config. This setting won't be applied to the karma defaults without this update.
With angular#1814 the `defaults.poll` property was added to angular-cli.json. This configuration setting is currently set to apply to `ng serve` but not `ng test`. This fix adds the setting to the defaults that are applied to karma's config object, so that if you set `defaults: { poll: 1000 }` it will apply to both `ng serve` and `ng test`.
With angular#1814 the `defaults.poll` property was added to angular-cli.json. This configuration setting is currently set to apply to `ng serve` but not `ng test`. This fix adds the setting to the defaults that are applied to karma's config object, so that if you set `defaults: { poll: 1000 }` it will apply to both `ng serve` and `ng test`.
…r#1814) Add watchOptions to webpackDevServerConfiguration to conditionally enable polling option in watchpack Remove additional blank lines from end of serve-watchpack.ts so that only one is remaining
With angular#1814 the `defaults.poll` property was added to angular-cli.json. This configuration setting is currently set to apply to `ng serve` but not `ng test`. This fix adds the setting to the defaults that are applied to karma's config object, so that if you set `defaults: { poll: 1000 }` it will apply to both `ng serve` and `ng test`. Fixup
With angular#1814 the `defaults.poll` property was added to angular-cli.json. This configuration setting is currently set to apply to `ng serve` but not `ng test`. This fix adds the setting to the defaults that are applied to karma's config object, so that if you set `defaults: { poll: 1000 }` it will apply to both `ng serve` and `ng test`. Fixup
With angular#1814 the `defaults.poll` property was added to angular-cli.json. This configuration setting is currently applies to `ng serve` but not `ng test`. This fix adds the poll value to the karma defaults so that if you set `defaults: { poll: 1000 }` it will apply to both `ng serve` and `ng test`.
With angular#1814 the `defaults.poll` property was added to angular-cli.json. This configuration setting currently applies to `ng serve` but not `ng test`. This fix adds the poll value to the karma defaults so that if you set `defaults: { poll: 1000 }` it will apply to both `ng serve` and `ng test`.
With angular#1814 the `defaults.poll` property was added to angular-cli.json. This configuration setting currently applies to `ng serve` but not `ng test`. This fix adds the poll value to the karma defaults so that if you set `defaults: { poll: 1000 }` it will apply to both `ng serve` and `ng test`.
With angular#1814 the `defaults.poll` property was added to angular-cli.json. This configuration setting currently applies to `ng serve` but not `ng test`. This fix adds the poll value to the karma defaults so that if you set `defaults: { poll: 1000 }` it will apply to both `ng serve` and `ng test`.
With #1814 the `defaults.poll` property was added to angular-cli.json. This configuration setting currently applies to `ng serve` but not `ng test`. This fix adds the poll value to the karma defaults so that if you set `defaults: { poll: 1000 }` it will apply to both `ng serve` and `ng test`.
…r#1814) Add watchOptions to webpackDevServerConfiguration to conditionally enable polling option in watchpack Remove additional blank lines from end of serve-watchpack.ts so that only one is remaining
…ar#2486) With angular#1814 the `defaults.poll` property was added to angular-cli.json. This configuration setting currently applies to `ng serve` but not `ng test`. This fix adds the poll value to the karma defaults so that if you set `defaults: { poll: 1000 }` it will apply to both `ng serve` and `ng test`.
…r#1814) Add watchOptions to webpackDevServerConfiguration to conditionally enable polling option in watchpack Remove additional blank lines from end of serve-watchpack.ts so that only one is remaining
With #1814 the `defaults.poll` property was added to angular-cli.json. This configuration setting currently applies to `ng serve` but not `ng test`. This fix adds the poll value to the karma defaults so that if you set `defaults: { poll: 1000 }` it will apply to both `ng serve` and `ng test`.
…ar#2486) With angular#1814 the `defaults.poll` property was added to angular-cli.json. This configuration setting currently applies to `ng serve` but not `ng test`. This fix adds the poll value to the karma defaults so that if you set `defaults: { poll: 1000 }` it will apply to both `ng serve` and `ng test`.
Without documentation, I don't know how to ignore "node_modules" directory. Can anyone tell me how to? |
@monad98 Currently there's no configuration options for this, the cli's webpack config would need to be updated to allow for setting this. https://github.com/angular/angular-cli/blob/master/packages/angular-cli/tasks/serve-webpack.ts#L100 and the other files from this PR to update the config schema. A separate issue/PR should be created for this to examine if this is desired. By ignoring files here the bundle would not rebuild when files are changed, if new modules are added or if existing node_modules are updated IMO it should trigger a rebuild. I understand the expense of watching the entire node_modules directory structure for changes on some older machines, but I haven't personally seen much of a slowdown here. @hansl will need to weigh in on if this is something that's wanted. |
Apologies for digging up this older PR but it's the first one with a comment that's my exact issue.
I'm running a Vagrant setup for a few things and consistently, if I use poll for webpack, I need to exclude When it comes to ng build, if I put @monad98 Were you ever able to resolve ignoring |
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. |
Add watchOptions to webpackDevServerConfiguration to conditionally enable polling option in watchpack
Remove additional blank lines from end of serve-watchpack.ts so that only one is remaining