diff --git a/README.md b/README.md index 7b560652..78c79318 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- +

🍭 My blog built with Gatsby + TypeScript. Neat. @@ -34,7 +34,7 @@ - [S3 Deployment](#s3-deployment) - [🏛 Licenses](#-licenses) - [Posts](#posts) - - [Photos & images](#photos--images) + - [Photos \& images](#photos--images) --- @@ -143,7 +143,6 @@ All SVG assets under `src/images/` will be converted to React components with th ```jsx import { ReactComponent as Logo } from './components/svg/Logo' - ; ``` diff --git a/gatsby-node.ts b/gatsby-node.ts index b2e93eb0..8db17512 100644 --- a/gatsby-node.ts +++ b/gatsby-node.ts @@ -1,4 +1,5 @@ import type { GatsbyNode } from 'gatsby' +import webpack from 'webpack' import { createExif } from './gatsby/createExif' import { createMarkdownFields } from './gatsby/createMarkdownFields' import { @@ -158,14 +159,21 @@ export const onPostBuild: GatsbyNode['onPostBuild'] = async ({ graphql }) => { return Promise.resolve() } -export const onCreateWebpackConfig: GatsbyNode['onCreateWebpackConfig'] = ({ - actions -}) => { - actions.setWebpackConfig({ - resolve: { - fallback: { - util: false +export const onCreateWebpackConfig: GatsbyNode['onCreateWebpackConfig'] = + async ({ actions }) => { + actions.setWebpackConfig({ + plugins: [ + new webpack.NormalModuleReplacementPlugin(/node:/, (resource) => { + resource.request = resource.request.replace(/^node:/, '') + }) + ], + resolve: { + fallback: { + util: false, + crypto: false, + path: false, + url: false + } } - } - }) -} + }) + }