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

Fix hot reloading by making auto-generated route components es6 classes instead of functional components #531

Closed
wants to merge 137 commits into from

Conversation

KyleAMathews
Copy link
Contributor

Turns out React-Router route components can't be functional components for hot reloading to work consistently with react-hot-loader-beta6... weird.

* Rename .gatsby-intermediate-build to .intermediate-build — gatsby was
redundant
* Add site as an object in the globals module + try out observables.
* Add api-runner which is the start of our new API/Plugin system.
This is either code made useless by new data + routes sytems or Webpack
config we no longer support out-of-the box due to the coming plugin
system.

The removed Sass, Less, TOML, YAML, JSON, image compression support will
be added back as plugins or now make more sense as GraphQL source
plugins.
Match the compiler metaphor we're following.
Can be source of bugs if old compiled file sticks around and old
requires keep working.
Currently deploying new version of the site breaks with service workers
as the extracted chunk manifest (loaded fresh everytime) doesn't match
the chunk ids used in some of the cached chunks.

At least that's my theory :-)

In any case, I keep seeing this error:

bootstrap 1a2fd54…:50 Uncaught TypeError: Cannot read property 'call' of
undefined

which disappears as soon as I update to the latest service worker or
bypass the service worker.

With the AppShell, everything will stay the same until the user updates
to the new version of the service worker so there shouldn't be more
trouble w/ mismatched module ids.
This is preparation for creating an API for sites and plugins to add
arbitrary types to the schema.
I thought this was necessary for npm link development but perhaps not? I
dunno... npm link is weird. Regardless, this breaks installing the 1.0
branch normally as then `node_modules/gatsby/node_modules` doesn't exist
which causes the webpack validation to fail.
React-hot-loader v3 requires all sub components to be required in a
different file.
React-Router route components can't be functional components for hot
reloading to work consistently with react-hot-loader-beta6... weird.
@0x80 0x80 deleted the fix-hot-reloading branch April 19, 2017 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants