2020-06-30 13:32:16 +02:00
|
|
|
exports.onCreateWebpackConfig = ({ actions }) => {
|
|
|
|
actions.setWebpackConfig({
|
|
|
|
node: {
|
|
|
|
// 'fs' fix for squid.js
|
|
|
|
fs: 'empty'
|
2020-07-16 12:24:05 +02:00
|
|
|
},
|
|
|
|
// fix for 'got'/'swarm-js' dependency
|
|
|
|
externals: ['got']
|
2020-06-30 13:32:16 +02:00
|
|
|
})
|
|
|
|
}
|
2020-07-01 17:11:45 +02:00
|
|
|
|
2020-07-07 10:26:38 +02:00
|
|
|
exports.onCreatePage = async ({ page, actions }) => {
|
|
|
|
const { createPage } = actions
|
|
|
|
// page.matchPath is a special key that's used for matching pages
|
|
|
|
// only on the client.
|
|
|
|
const handleClientSideOnly = page.path.match(/^\/asset/)
|
2020-07-06 12:49:30 +02:00
|
|
|
|
2020-07-07 10:26:38 +02:00
|
|
|
if (handleClientSideOnly) {
|
|
|
|
page.matchPath = '/asset/*'
|
2020-07-06 12:49:30 +02:00
|
|
|
|
2020-07-07 10:26:38 +02:00
|
|
|
// Update the page.
|
|
|
|
createPage(page)
|
|
|
|
}
|
|
|
|
}
|