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

ream dev triple rebuild #124

Closed
IlyaSemenov opened this issue Oct 15, 2018 · 3 comments
Closed

ream dev triple rebuild #124

IlyaSemenov opened this issue Oct 15, 2018 · 3 comments
Labels

Comments

@IlyaSemenov
Copy link
Contributor

Typically starting ream dev leads to triple recompile:

~/work/github/ream/examples/prepopulate-vuex tests*
❯ ../../bin/cli.js dev|tee /dev/null
[3:34:37 PM] Compiling client
[3:34:37 PM] Compiling server
(node:11833) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
[3:34:38 PM] Compiled server in 1s
[15:34:37] Rebuilding due to changes made in .ream/create-app.js
[3:34:38 PM] Compiled client in 1s

  App running at:

  - Local: http://localhost:4000
  - Network: http://10.0.2.141:4000
[15:34:36] Rebuilding due to changes made in .ream/create-app.js
[3:34:38 PM] Compiling server
[3:34:38 PM] Compiled server in 39ms

  App running at:

  - Local: http://localhost:4000
  - Network: http://10.0.2.141:4000
[3:34:38 PM] Compiling client
[3:34:38 PM] Compiled client in 14ms

  App running at:

  - Local: http://localhost:4000
  - Network: http://10.0.2.141:4000
^C
@IlyaSemenov
Copy link
Contributor Author

I think that time-fix-plugin could be not doing its stuff properly. I added a few console logs:

    compiler.watch = function () {
      console.log(`[${new Date()}] time-fix-plugin compiler.watch`)
      watching = watch.apply(this, arguments)
      console.log(`[${new Date()}] time-fix-plugin compiler.watch created watching`)
      return watching
    }

    compiler.hooks.watchRun.tap('time-fix-plugin', () => {
      console.log(`[${new Date()}] time-fix-plugin watchRun watchin ${watching && new Date(watching.startTime)}`)
      if (watching) {
        watching.startTime += this.watchOffset
        offsetApplied = true
      }
    })

and the output is:

❯ ../../bin/cli.js dev|tee /dev/null
>>> writing create app file
>>> writing create app file complete
[Mon Oct 15 2018 17:07:01 GMT+0700 (Novosibirsk Standard Time)] time-fix-plugin compiler.watch
[Mon Oct 15 2018 17:07:01 GMT+0700 (Novosibirsk Standard Time)] time-fix-plugin watchRun watchin undefined
[5:07:01 PM] Compiling client
[Mon Oct 15 2018 17:07:01 GMT+0700 (Novosibirsk Standard Time)] time-fix-plugin compiler.watch created watching
[Mon Oct 15 2018 17:07:01 GMT+0700 (Novosibirsk Standard Time)] time-fix-plugin compiler.watch
[Mon Oct 15 2018 17:07:01 GMT+0700 (Novosibirsk Standard Time)] time-fix-plugin watchRun watchin undefined
[5:07:01 PM] Compiling server
[Mon Oct 15 2018 17:07:01 GMT+0700 (Novosibirsk Standard Time)] time-fix-plugin compiler.watch created watching
(node:4165) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
[5:07:02 PM] Compiled server in 730ms
report-change
[17:7:2] Rebuilding due to changes made in .ream/create-app.js
[5:07:02 PM] Compiled client in 876ms

  App running at:

  - Local: http://localhost:4000
  - Network: http://172.22.10.217:4000
report-change
[17:7:1] Rebuilding due to changes made in .ream/create-app.js
[Mon Oct 15 2018 17:07:02 GMT+0700 (Novosibirsk Standard Time)] time-fix-plugin watchRun watchin Mon Oct 15 2018 17:07:02 GMT+0700 (Novosibirsk Standard Time)
[5:07:02 PM] Compiling server
[5:07:02 PM] Compiled server in 28ms

  App running at:

  - Local: http://localhost:4000
  - Network: http://172.22.10.217:4000
[Mon Oct 15 2018 17:07:02 GMT+0700 (Novosibirsk Standard Time)] time-fix-plugin watchRun watchin Mon Oct 15 2018 17:07:02 GMT+0700 (Novosibirsk Standard Time)
[5:07:02 PM] Compiling client
[5:07:02 PM] Compiled client in 24ms

  App running at:

  - Local: http://localhost:4000
  - Network: http://172.22.10.217:4000

you can see that during the first watchRun hook invocation, watching is still undefined (because watch.apply has not completed). This probably (?) leads to the false positive.

However it's not not necessary the cause because when I add a 1 second pause to writeCreateAppFile(), it never rebuilds multiple times:

❯ ../../bin/cli.js dev|tee /dev/null
>>> writing create app file and pausing 1 second
>>> writing create app file complete
[Mon Oct 15 2018 17:12:51 GMT+0700 (Novosibirsk Standard Time)] time-fix-plugin compiler.watch
[Mon Oct 15 2018 17:12:51 GMT+0700 (Novosibirsk Standard Time)] time-fix-plugin watchRun watchin undefined
[5:12:51 PM] Compiling client
[Mon Oct 15 2018 17:12:51 GMT+0700 (Novosibirsk Standard Time)] time-fix-plugin compiler.watch created watching
[Mon Oct 15 2018 17:12:51 GMT+0700 (Novosibirsk Standard Time)] time-fix-plugin compiler.watch
[Mon Oct 15 2018 17:12:51 GMT+0700 (Novosibirsk Standard Time)] time-fix-plugin watchRun watchin undefined
[5:12:51 PM] Compiling server
[Mon Oct 15 2018 17:12:51 GMT+0700 (Novosibirsk Standard Time)] time-fix-plugin compiler.watch created watching
(node:4554) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
[5:12:52 PM] Compiled server in 696ms
[5:12:52 PM] Compiled client in 818ms

  App running at:

  - Local: http://localhost:4000
  - Network: http://172.22.10.217:4000

@egoist thoughts?

@IlyaSemenov
Copy link
Contributor Author

@egoist please see the suggested fix: egoist/time-fix-plugin#2

I can't say I'm 100% sure in the fix, but it fixes this issue and doesn't break watching. I could be missing something of course.

egoist referenced this issue in egoist/time-fix-plugin Oct 16, 2018
* fix: prevent extra first recompilation

See ream/ream#124 for the test case

* Fix this
@IlyaSemenov IlyaSemenov changed the title yarn dev triple recompile ream dev triple rebuild Oct 16, 2018
@IlyaSemenov
Copy link
Contributor Author

🎉 This issue has been resolved in version 3.3.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant