Skip to content
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

Recompiles continuously until recently modified file is 10 seconds old #51

Closed
danoc opened this issue May 22, 2017 · 3 comments
Closed

Comments

@danoc
Copy link

danoc commented May 22, 2017

Hello,

I'm using webpack-dev-server and a custom script to build and view a project I'm working on. I run it like this:

./docs/scripts/index.js && webpack-dev-server

The Node script creates a JSON file that is required in my bundle and that webpack-dev-server watches. The problem, however, is that webpack-dev-sever will constantly recompile until the JSON file is 10 seconds old.

Below is the console output. I've added my own console.log's within watchpack (prefixed by ***) to monitor the timestamps. The recompilation loop ends when the timestamp in DirectoryWatcher.js (L178) is at least 10,000 more than the timestamp in watchpack.js (L100).

*** DirectoryWatcher.js 1495481025082
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 1905ms
    Asset     Size  Chunks                    Chunk Names
bundle.js  1.05 MB       0  [emitted]  [big]  main
chunk    {0} bundle.js (main) 1.02 MB [entry] [rendered]
   [26] ./~/react/lib/React.js 3.32 kB {0} [built]
  [100] ./~/react/react.js 56 bytes {0} [built]
  [116] ./docs/index.js 1.17 kB {0} [built]
  [117] (webpack)-dev-server/client?http://localhost:8080 5.68 kB {0} [built]
  [120] ./packages/tp-react-button/index.js 770 bytes {0} [built]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
  [145] ./~/punycode/punycode.js 14.7 kB {0} [built]
  [150] ./~/react-dom/index.js 59 bytes {0} [built]
  [164] ./~/react-dom/lib/ReactDOM.js 5.14 kB {0} [built]
  [261] ./~/strip-ansi/index.js 161 bytes {0} [built]
  [262] ./~/url/url.js 23.3 kB {0} [built]
  [264] (webpack)-dev-server/client/overlay.js 3.73 kB {0} [built]
  [265] (webpack)-dev-server/client/socket.js 897 bytes {0} [built]
  [267] (webpack)/hot/emitter.js 77 bytes {0} [built]
  [268] multi (webpack)-dev-server/client?http://localhost:8080 ./docs/index.js 40 bytes {0} [built]
     + 254 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481034000
webpack: Compiling...
*** DirectoryWatcher.js 1495481027271
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 66ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481027556
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 20ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481027794
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 27ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481028041
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 19ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481028288
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 17ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481028523
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 24ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481028762
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 21ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481029002
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 28ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481029244
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 20ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481029489
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 17ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481029726
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 31ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481029972
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 18ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481030206
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 26ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481030451
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 26ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481030697
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 17ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481030932
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 26ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481031176
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 17ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481031421
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 17ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481031656
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 25ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481031902
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 18ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481032139
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 27ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481032382
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 16ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481032627
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 18ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481032860
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 23ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481033101
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 17ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481033339
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 28ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481033583
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 17ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481033823
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 16ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.
*** watchpack.js 1495481024000
webpack: Compiling...
*** DirectoryWatcher.js 1495481034058
Hash: f6e60d3196316658e060
Version: webpack 2.5.1
Time: 25ms
chunk    {0} bundle.js (main) 1.02 MB [entry]
  [140] ./packages/tp-react-button/dist/props.json 398 bytes {0} [built]
     + 268 hidden modules
webpack: Compiled successfully.

I do not see this problem if I run the documentation script first, manually wait ten seconds, then run webpack-dev-server.

The number seems to correspond to FS_ACCURACY, but I don't understand how that works.

@danoc danoc changed the title Recompiles continuously for until recently modified file is 10 seconds old Recompiles continuously until recently modified file is 10 seconds old May 22, 2017
@mwistrand
Copy link

I've run into the same issue; within our webpack config, we have a loader that maps CSS modules to TypeScript definition files. When these d.ts files are created or modified for the first time, the initial change event fires, with the mtime set 10000ms in the future. Subsequent change events are then fired until the compilation's start time passes that mark. I don't see any code comments, commits, or previous bugs explaining what FS_ACCURACY is meant to solve, so I'm wary of submitting a PR since any change I make could very well break intended functionality.

mwistrand pushed a commit to mwistrand/cli-build-webpack that referenced this issue Jun 9, 2017
See webpack/watchpack#51 for more information.
Adds a temporary webpack plugin that prevents new compilations from
being triggered when new files are added during the initial build when
the --watch flag is set.
@ghost
Copy link

ghost commented Jun 15, 2017

Think this is related to issue #25.

@danoc
Copy link
Author

danoc commented Jun 17, 2017

Looks like it is a duplicate. Will close this.

@danoc danoc closed this as completed Jun 17, 2017
agubler pushed a commit to dojo/cli-build-webpack that referenced this issue Aug 9, 2017
* Prevent css.d.ts files from triggering builds.

When CSS files are changed, any newly-created css.d.ts files should not
trigger rebuilds in watch mode.

* Add stopgap IgnoreUnmodifiedPlugin

See webpack/watchpack#51 for more information.
Adds a temporary webpack plugin that prevents new compilations from
being triggered when new files are added during the initial build when
the --watch flag is set.

* Run IgnoreUnmodifiedPlugin only in watch mode.
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

No branches or pull requests

2 participants