gajus / gajus/isomorphic-webpack

Use with offline-plugin

Open
#23 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
289
Forks
16
PR merge metrics
No merged PRs in 30d

Description

Is there a working example of `isomorphic-webpack` + [`offline-plugin`](https://github.com/NekR/offline-plugin) anyone might be able to share? I encounter this error when trying to use `offline-plugin` in my `isomorphic-webpack` app:

```
/home/tyler/Projects/webpack2test/node_modules/offline-plugin/runtime.js:3
if (window.console) {
^

ReferenceError: window is not defined
at Object. (/home/tyler/Projects/webpack2test/node_modules/offline-plugin/runtime.js:3:5)
```

: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 before `index.jsx`), I end up with an error like this :arrow_down:

```
TypeError: Cannot read property './index.jsx' of undefined
at evalBundleCode (/home/tyler/Projects/webpack2test/node_modules/isomorphic-webpack/dist/factories/createIsomorphicWebpack.js:133:37)
at /home/tyler/Projects/webpack2test/src/server/server.js:141:21
at Layer.handle [as handle_request] (/home/tyler/Projects/webpack2test/node_modules/router/lib/layer.js:93:5)
```

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?)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.