Open tyler-dot-earth opened 7 years ago
I haven't dealt much with server-side rendering (so I don't know how (or if) other SSR approaches have solved this in some other way) but since things like these (window
, self
, probably localStorage
) are coming up a lot, could we make these available globally in node env before executing the client-side code? Like by using jsdom-global? or manually making these types of variables global?
Looping @NekR, creator of offline-plugin
in on this issue (we tweeted a little).
@tsnieman yeah, I already keep it open to take a look. Will do a bit later today :-)
@tsnieman okay, so isomorphic-webpack
doesn't really support window
, self
, top
, parent
, etc. right?
Btw, that window.console
check exists only in stub of offline-plugin
runtime. If you got stub means that you probably forgot to add the plugin to the list of webpack plugins in its config.
I'm getting self is not defined
even by just running the demo: https://github.com/gajus/isomorphic-webpack-demo
Is the demo supposed to work?
@NekR Upstream dependency (style-loader) caused that error. Try from the branch I have open in the PR here: https://github.com/gajus/isomorphic-webpack-demo/pull/7
Branch (aka working demo) itself can be found directly @ https://github.com/tsnieman/isomorphic-webpack-demo/tree/fix-style-loader-dep
Is there a working example of
isomorphic-webpack
+offline-plugin
anyone might be able to share? I encounter this error when trying to useoffline-plugin
in myisomorphic-webpack
app::arrow_up: In this case, I added the
require('offline-plugin/runtime').install()
line to my entry file, before the app client itself (index.jsx
).If I try to install the plugin/runtime in
index.jsx
itself (instead of in the webpack entry just beforeindex.jsx
), I end up with an error like this :arrow_down:I realise this isn't exactly a problem with
isomorphic-webpack
itself, but I imagine I'll have better luck here than their repo. I'd be happy to provide some code to play with if it would help(Alternatively: anyone have suggestions for building this offline functionality without this plugin?)