Building steps on yarn start
Build & system info:
macOS 10.13.2 Beta (17C60c)
Node v8.9.0
npm v5.5.1
react-static v4.0.1
I'm not quite sure if this is intended (i.e. it logs every file being built), or if this is a bug.
During my initial run of yarn start I noticed the log output Build Complete: {time in ms} reported it built 11 times (reporting Rebuilding and Build Complete: {time in ms}).
I'm just wondering if this is intended as I stated above, if it's logging the build of every file, or if this is a bug. Thanks!
Interesting. I get this behaviour as well, with the following versions:
macOS 10.12.6
Node 6.9.0
npm 5.5.1
yarn 1.2.1
react-static 4.0.1
I looked into it a bit, and it looks like it's an issue with WebpackDevServer hot reloading.
It can be "fixed" by changing the timestamp of the index.html file to some time in the past in the devCompiler done callback, like this:
if (first) {
first = false
const indexFile = path.resolve(HTML_TEMPLATE)
const now = Date.now() / 1000
const then = now - 15
fs.utimes(indexFile, then, then, err => { if (err) throw err })
console.log(chalk.green('=> [\u2713] App serving at'), `http://localhost:${port}`)
}
But I'm not sure this is reliable, since the build will take longer time as the project grows.
The same thing happens for me every time without fail on a checkout from master on my Arch Linux install. It's not a problem at all however on my Windows machine.
Version details which could be useful:
- Arch Linux (updated 2017.11.05)
- node @ 8.8.1
- npm @ 5.5.1
- yarn @ 1.3.2
- react-static @ 839a4de
It's a bug! On Sun, Nov 5, 2017 at 1:46 AM Corbin Matschull [email protected] wrote:
Build & system info:
macOS 10.13.2 Beta (17C60c) Node v8.9.0 npm v5.5.1 react-static v4.0.1I'm not quite sure if this is intended (i.e. it logs every file being built), or if this is a bug. During my initial run of yarn start I noticed the log output Build Complete: {time in ms} reported it built 11 times (reporting Rebuilding and Build Complete: {time in ms}).
I'm just wondering if this is intended as I stated above, if it's logging the build of every file, or if this is a bug. Thanks!
β You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nozzle/react-static/issues/124, or mute the thread https://github.com/notifications/unsubscribe-auth/AFUmCUA2uzMghwgffCp-Tq00kIT1A00zks5szWfNgaJpZM4QSSyG .
Hmmm @EmilTholin so... Should this be sent over the Webpack folks? Or keep it here?
@cgmx I think it would be most beneficial to fix the underlying issue in Webpack, so that this particular issue will be solved automatically by just upgrading, rather than adding an ugly hack.
Agreed, @EmilTholin. Hacks = bad, fix = good.
Apparently the common agreement over at Webpack is that FS_ACCURACY is the troublemaker, a more detailed analysis of this is written over on this issue (Webpack)
So the decision here is "let Webpack sort it out" I'm closing this task, unless @EmilTholin you want it kept open for purely historical or reference purposes.
I think @tannerlinsley should have a last word on that. I personally think it would be valuable to have this issue open until Webpack resolves it, so other react-static users can find this here easily in the meantime.
Alrighty, it's up to him then! I'll let him close or leave this task. Thanks for the help and input π
I previously dealt with this by faking out the file system.
I think we should strive to find a temporary solution in addition to helping and hoping webpack issues a fix. I really don't like it when this happens. On Sun, Nov 5, 2017 at 1:49 PM Corbin Matschull [email protected] wrote:
Alrighty, it's up to him then! I'll let him close or leave this task. Thanks for the help and input π
β You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nozzle/react-static/issues/124#issuecomment-342004264, or mute the thread https://github.com/notifications/unsubscribe-auth/AFUmCaECTYybyLHF7GvsyF-QCvyk97KHks5szh9DgaJpZM4QSSyG .
@tannerlinsley, from what I've been reading has to do with FS_ACCURACY (more info here)
A hotfix I saw for webpack-dev-middleware that resides here:
const compiler = webpack(webpackConfig);
const timefix = 11000;
compiler.plugin('watch-run', (watching, callback) => {
watching.startTime += timefix;
callback()
});
compiler.plugin('done', (stats) => {
stats.startTime -= timefix
})
I think this would help fix it in the meantime. Unless a fix would be implemented in Webpack itself and then react-static could use a custom build of it until Webpack implements an official fix.
Multiple options in this case.
If you can verify that fixes it, I will accept that until itβs fixed officially in web pack. That is much more elegant that modifying the internal file systems time created.
On Sun, Nov 5, 2017 at 2:49 PM Corbin Matschull [email protected] wrote:
@tannerlinsley https://github.com/tannerlinsley, from what I've been reading has to do with FS_ACCURACY (more info here https://github.com/webpack/watchpack/issues/25#issuecomment-232713980)
A hotfix I saw for webpack-dev-middleware resides here https://github.com/webpack/watchpack/issues/25#issuecomment-319292564:
const compiler = webpack(webpackConfig); const timefix = 11000; compiler.plugin('watch-run', (watching, callback) => { watching.startTime += timefix; callback() }); compiler.plugin('done', (stats) => { stats.startTime -= timefix })
I think this would help fix it in the meantime. Unless a fix would be implemented in Webpack itself and then react-static could use a custom build of it until Webpack implements an official fix.
Multiple options in this case.
β You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nozzle/react-static/issues/124#issuecomment-342008635, or mute the thread https://github.com/notifications/unsubscribe-auth/AFUmCRQFveoqivq6XawgSAY8YuaQyRiEks5szi1UgaJpZM4QSSyG .
Agreed. I'll work on a hotfix and submit a PR sometime this evening or tomorrow morning.
Awesome. Thanks!
On Sun, Nov 5, 2017 at 3:58 PM Corbin Matschull [email protected] wrote:
Agreed. I'll work on a hotfix and submit a PR sometime this evening or tomorrow morning.
β You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nozzle/react-static/issues/124#issuecomment-342013074, or mute the thread https://github.com/notifications/unsubscribe-auth/AFUmCY0W7uSe44VBBAkzT9B9YNhD_OoUks5szj2ZgaJpZM4QSSyG .
Be sure to note (and hopefully remove) the existing hack for this here: https://github.com/nozzle/react-static/blob/master/src/static.js#L312
Yup no worries. I'll get a good piece of documentation on why that was removed. π
So I have located where I can implemented this hotfix:
In-file: /master/src/webpack.js#L53 Pretty sure I can just drop the hotfix into there after the build complete message.
I'll report back if this resolves it.
Good plan. Lmk how it goes
Closing this issue as a hotfix was implemented and merged into master.