Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,12 @@ onUpdateReady: function() {
OfflinePlugin.applyUpdate();
}
```

**How can I use absolute paths?**
By default `offline-plugin` uses `relativePaths: true`. You can override this by setting an (absolute) `publicPath`. This makes `offline-plugin` ignore `relativePaths`:

```js
new OfflinePlugin({
publicPath: '/'
})
```
1 change: 1 addition & 0 deletions docs/runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require('offline-plugin/runtime').install();
```

ES6/Babel/TypeScript

```js
import * as OfflinePluginRuntime from 'offline-plugin/runtime';
OfflinePluginRuntime.install();
Expand Down
7 changes: 5 additions & 2 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Automatic updates isn't the default behavior, but can be achieved using the [aut

#### All routes/resources aren't being cached


`offline-plugin` automatically caches all resources generated by webpack. Any other resource needs to be explicitly cached as [external](options.md#externals-arraystring).

#### Some pages / resources are not being served at all
Expand Down Expand Up @@ -55,6 +54,10 @@ There are multiple ways to fix this depending on your setup. One way is to set [

`offline-plugin` can cache resources served from a CDN, given the correct configuration. Make sure the resources are served with the correct headers.

#### DOMException: Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/html') Error

Make sure your webserver is serving your assets (including `sw.js`) with the correct mime type. Also, make sure you are using relative / absolute paths correctly (see the [`FAQ`](FAQ.md) regarding this). Also make sure that ServiceWorker and/or AppCache files are generated into the correct folder. You may use `ServiceWorker.output` and `AppCache.output` to change the output path. See [options](options.md) for details.

#### Fetching the ServiceWorker results in an error

Some errors, like being unable to fetch the ServiceWorker file, originates from the browser, network or server and are out of control of `offline-plugin`. Here is a list of common errors and their causes.
Expand All @@ -77,4 +80,4 @@ This is a proxy issue. Ie. someone sitting at an airport or on a train and that

#### How to handle out-of-control errors

As the above errors are out of the control of `offline-plugin`, there is nothing we can do to prevent them. What you may do if you receive any of them is to catch them in your code and try to reschedule the update. Also make sure that your server works correctly and remove any potential bugs / error situation causing HTTP 500 Internal Server Error.
As the above errors are out of the control of `offline-plugin`, there is nothing we can do to prevent them. What you may do if you receive any of them is to catch them in your code and try to reschedule the update. Also make sure that your server works correctly and remove any potential bugs / error situation causing HTTP 500 Internal Server Error.