Gatsby
Installing Edgemesh on a Gatsby JAM Stack.

Create Service Worker

Create a file in the static folder of your Gatsby project called sw.jsand add the following line:
sw.js
1
importScripts('https://static.edgeme.sh/edgemesh-sw.js')
Copied!

Add the Edgemesh Plugin

Install the plugin with from NPM.
1
$ npm i gatsby-plugin-edgemesh --save
Copied!
Enable the plugin in your gatsby-config.js.
gatsby-config.js
1
module.exports = {
2
plugins: [
3
'gatsby-plugin-edgemesh'
4
]
5
}
Copied!
The Gatsby plugin accepts the same options as all of the other Edgemesh Clients.
gatsby-config.js
1
module.exports = {
2
plugins: [{
3
resolve: 'gatsby-plugin-edgemesh',
4
options: {
5
// Edgemesh Options
6
host: API_URL,
7
swUrl: '/sw.js',
8
scope: '/',
9
lite: false,
10
externalMount: false,
11
softDisable: false
12
}
13
}]
14
}
Copied!
Last modified 1yr ago