Skip to content

Conversation

@Kocal
Copy link
Member

@Kocal Kocal commented Jan 7, 2019

This PR adds support for properly configuring watching options.
References: #35, #126

Before, we had to do this:

const config = Encore.getWebpackConfig();

if (config.devServer) {
  config.devServer.watchOptions.poll = 250;
}

Now, we can do this:

Encore.configureWatchOptions(watchOptions => {
    watchOptions.poll = 250;
});

Also, I think it would be better to rename it to configureWatchOptions(), but I don't know how encore apply watching options to webpack when running dev or prod environment with encore [prod|dev] --watch. 🤔

Thanks!


EDIT: Ah, I found it!
selection_052

I will see how can I modify watchOptions in dev/prod modes.

@Kocal Kocal force-pushed the feat/configure-watch-options branch from 6751e5e to e6eb6e1 Compare January 7, 2019 16:42
@Lyrkan
Copy link
Collaborator

Lyrkan commented Jan 7, 2019

Hi @Kocal,

Encore.configureDevServerWatchOptions() feels a bit long to me, configureWatchOptions() would probably be better imo.

That being said... I'm wondering if we shouldn't have a configureDevServer instead? Is watchOptions really that special to justify giving it its own method?

@Kocal
Copy link
Member Author

Kocal commented Jan 7, 2019

Watch mode can be used without a dev-server, so I think it's better to have a .configureWatchOptions() methods that applies both for webpack and webpack-dev-server.

@Kocal Kocal changed the title feat: configure devServer watching options feat: configure watching options Jan 7, 2019
@Kocal
Copy link
Member Author

Kocal commented Jan 7, 2019

What should I do with failing tests? It's working fine on local 😕
capture d ecran de 2019-01-07 20-22-01

@Lyrkan
Copy link
Collaborator

Lyrkan commented Jan 7, 2019

Don't worry about the failing tests, they are not related to your PR :)

You don't have them locally because they are in a Travis job that tests the highest possible version of the dependencies (it removes the lock file before downloading them) and sometimes Webpack changes something that causes the hardcoded hashes from our functional tests to become outdated.

@Kocal
Copy link
Member Author

Kocal commented Jan 7, 2019

Oh okay, thanks for the explanation 👍

@Kocal
Copy link
Member Author

Kocal commented Jan 21, 2019

Who is ready for a new review? 😺

@Lyrkan
Copy link
Collaborator

Lyrkan commented Jan 29, 2019

Thank you @Kocal
As you can see in symfony/symfony-docs#10923 this was definitely needed :)

@Kocal Kocal deleted the feat/configure-watch-options branch January 29, 2019 17:01
@Kocal
Copy link
Member Author

Kocal commented Jan 29, 2019

Yep! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants