Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

feat(serve): Optionally use Webpack's polling watcher #73

Open
wants to merge 1 commit into
base: v2-beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ Serve.loadSettings = function loadSettings(argv, project) {
options.browser = options.browser || options.defaultBrowser;

options.watchPatterns = project.get('watchPatterns') || ['www/**/*', '!www/lib/**/*'];
options.watchPoll = !!argv['watch-poll'];
options.printConsoleLogs = argv.consolelogs || argv['console-logs'] || argv.c;
options.printServerLogs = argv.serverlogs || argv['server-logs'] || argv.s;
options.isAddressCmd = argv._[0].toLowerCase() == 'address';
Expand Down
6 changes: 5 additions & 1 deletion lib/v2/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ Build.bundle = function(options) {
var compiler = webpack(config);
if (options.watch) {
//TODO expose watch options
compiler.watch(null, compileHandler);
var watchOptions = {};
if (options.watchPoll) {
watchOptions.poll = true;
}
compiler.watch(watchOptions, compileHandler);
} else {
compiler.run(compileHandler);
}
Expand Down