{"action":"created","issue":{"url":"https://api.github.com/repos/mdreizin/gulp-webpack-build/issues/7","labels_url":"https://api.github.com/repos/mdreizin/gulp-webpack-build/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/mdreizin/gulp-webpack-build/issues/7/comments","events_url":"https://api.github.com/repos/mdreizin/gulp-webpack-build/issues/7/events","html_url":"https://github.com/mdreizin/gulp-webpack-build/issues/7","id":56607287,"number":7,"title":"watch() not writing any files","user":{"login":"cowwoc","id":633348,"avatar_url":"https://avatars.githubusercontent.com/u/633348?v=3","gravatar_id":"","url":"https://api.github.com/users/cowwoc","html_url":"https://github.com/cowwoc","followers_url":"https://api.github.com/users/cowwoc/followers","following_url":"https://api.github.com/users/cowwoc/following{/other_user}","gists_url":"https://api.github.com/users/cowwoc/gists{/gist_id}","starred_url":"https://api.github.com/users/cowwoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cowwoc/subscriptions","organizations_url":"https://api.github.com/users/cowwoc/orgs","repos_url":"https://api.github.com/users/cowwoc/repos","events_url":"https://api.github.com/users/cowwoc/events{/privacy}","received_events_url":"https://api.github.com/users/cowwoc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-04T23:58:55Z","updated_at":"2015-02-05T02:16:11Z","closed_at":null,"body":"`gulp.watch()` is invoking this method on \"change\":\r\n\r\n```\r\n\tconsole.log(\"*** webpack.watch: \" + event.path);\r\n\twebpack.watch(event.path, webpackOptions,\r\n\t{\r\n\t\tbase: path.resolve(event.path)\r\n\t}, function(err, stats)\r\n\t{\r\n\t\tconsole.log(\"*** webpack.proxy: \" + event.path + \", err: \" + toJson(err) + \", stats: \" + toJson(stats));\r\n\t\tgulp.src(event.path).\r\n\t\t\tpipe(webpack.proxy(err, stats)).\r\n\t\t\tpipe(webpack.format(\r\n\t\t\t{\r\n\t\t\t\tversion: false\r\n\t\t\t})).\r\n\t\t\tpipe(gulp.dest(\".\")).\r\n\t\t\tpipe(reload({stream: true}));\r\n\t});\r\n```\r\n\r\nI am getting this output:\r\n\r\n```\r\n*** webpack.watch: C:\\Users\\Gili\\Documents\\realestate\\frontend\\src\\main\\webapp\\com\\realestate\\frontend\\page\\Index.scss\r\n[18:51:46] Watching webpack config ~\\Documents\\realestate\\frontend\\webpack.config.js\r\n*** webpack.proxy: C:\\Users\\Gili\\Documents\\realestate\\frontend\\src\\main\\webapp\\com\\realestate\\frontend\\page\\Index.scss, err: null, stats: \r\n{\r\n  \"compilation\": ...,\r\n  \"hash\": \"7c392354865954de5f01\",\r\n  \"startTime\": 1423093906078,\r\n  \"endTime\": 1423093906855\r\n}\r\n[18:51:46] Compiling webpack config ~\\Documents\\realestate\\frontend\\webpack.config.js\r\n[18:51:46] \r\n              Asset    Size  Chunks             Chunk Names\r\n      Properties.js   30371       0  [emitted]  Properties\r\n Authentications.js    8661       1  [emitted]  Authentications\r\n           Index.js    2191       2  [emitted]  Index\r\n           Users.js   12341       3  [emitted]  Users\r\n          Common.js  131123       4  [emitted]  Common\r\nAuthentications.css     449       1  [emitted]  Authentications\r\n          Index.css     632       2  [emitted]  Index\r\n         Common.css     190       4  [emitted]  Common\r\nChild extract-text-webpack-plugin:\r\n    \r\nChild extract-text-webpack-plugin:\r\n    \r\nChild extract-text-webpack-plugin:\r\n    \r\n[BS] 8 files changed (Properties.js, Authentications.js, Index.js, Users.js, Common.js, Authentications.css, Index.css, Common.css)\r\n*** webpack.proxy: C:\\Users\\Gili\\Documents\\realestate\\frontend\\src\\main\\webapp\\com\\realestate\\frontend\\page\\Index.scss, err: null, stats: \r\n{\r\n  \"compilation\": ...,\r\n  \"hash\": \"7c392354865954de5f01\",\r\n  \"startTime\": 1423093907182,\r\n  \"endTime\": 1423093907231\r\n}\r\n[18:51:47] Starting 'csslint'...\r\n[18:51:47] Compiling webpack config ~\\Documents\\realestate\\frontend\\webpack.config.js\r\n[18:51:47] \r\n              Asset  Size  Chunks             Chunk Names\r\nAuthentications.css   449       1  [emitted]  Authentications\r\n          Index.css   632       2  [emitted]  Index\r\n         Common.css   190       4  [emitted]  Common\r\n[18:51:47] Finished 'csslint' after 20 ms\r\n[18:51:47] Starting 'css'...\r\n[18:51:47] Finished 'css' after 7.02 Î¼s\r\n[BS] 3 files changed (Authentications.css, Index.css, Common.css)\r\n```\r\n\r\nSome observations:\r\n1. `webpack.watch()` is being invoked once (which is correct) but `webpack.proxy()` is being invoked twice for the same file (which is incorrect). Why is that? As you can see `stats.hash` is the same.\r\n2. `[BS] 3 files changed (Authentications.css, Index.css, Common.css)` is printed by `pipe(reload({stream: true}))` (BS stands for http://www.browsersync.io/) indicating that webpack modified those 3 files but when I check the files are never actually written to disk.\r\n3. In https://github.com/mdreizin/gulp-webpack-build/issues/2#issuecomment-72286131 I discovered that for non-watch builds `gulp.src()` is supposed to take in `webpack.config.js`. I am a little surprised to see that `webpack.watch()` does not take in `webpack.config.js` but instead takes in a configuration object (the contents of `webpack.config.js`). Is this a bug in my script? Should I be feeding in `webpack.config.js` anywhere?\r\n4. I am modifying `Index.scss` and expecting webpack to output `Index.css`. Instead, it seems to be re-running the full build (outputting Javascript files in the process). How do I get it to only overwrite the modified CSS file?\r\n\r\nThanks..."},"comment":{"url":"https://api.github.com/repos/mdreizin/gulp-webpack-build/issues/comments/72982305","html_url":"https://github.com/mdreizin/gulp-webpack-build/issues/7#issuecomment-72982305","issue_url":"https://api.github.com/repos/mdreizin/gulp-webpack-build/issues/7","id":72982305,"user":{"login":"cowwoc","id":633348,"avatar_url":"https://avatars.githubusercontent.com/u/633348?v=3","gravatar_id":"","url":"https://api.github.com/users/cowwoc","html_url":"https://github.com/cowwoc","followers_url":"https://api.github.com/users/cowwoc/followers","following_url":"https://api.github.com/users/cowwoc/following{/other_user}","gists_url":"https://api.github.com/users/cowwoc/gists{/gist_id}","starred_url":"https://api.github.com/users/cowwoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cowwoc/subscriptions","organizations_url":"https://api.github.com/users/cowwoc/orgs","repos_url":"https://api.github.com/users/cowwoc/repos","events_url":"https://api.github.com/users/cowwoc/events{/privacy}","received_events_url":"https://api.github.com/users/cowwoc/received_events","type":"User","site_admin":false},"created_at":"2015-02-05T02:16:11Z","updated_at":"2015-02-05T02:16:11Z","body":"Repro steps:\r\n\r\n1. Clone https://github.com/cowwoc/gulp-webpack-build-issue7\r\n2. `npm install` in the root directory\r\n3. Run `gulp build` and confirm that `target/classes/Index.js` is created containing `var version = 9;`\r\n4. Run `gulp watch`\r\n5. Edit `src/main/webapp/Index.js`, set `version = 10`, save file.\r\n6. Open `target/classes/Index.js`, confirm that it still contains `var version = 9;`\r\n7. To prove that nothing is being written, delete `target/classes/Index.js`, update `src/main/webapp/Index.js` again and notice that `target/classes/Index.js` is not recreated."}}