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
sw.js
importScripts('https://static.edgeme.sh/edgemesh-sw.js')

Add the Edgemesh Plugin

Install the plugin with from NPM.

$ npm i gatsby-plugin-edgemesh --save

Enable the plugin in your gatsby-config.js.

gatsby-config.js
gatsby-config.js
module.exports = {
plugins: [
'gatsby-plugin-edgemesh'
]
}

The Gatsby plugin accepts the same options as all of the other Edgemesh Clients.

gatsby-config.js
gatsby-config.js
module.exports = {
plugins: [{
resolve: 'gatsby-plugin-edgemesh',
options: {
// Edgemesh Options
host: API_URL,
swUrl: '/sw.js',
scope: '/',
lite: false,
externalMount: false,
softDisable: false
}
}]
}

‚Äč