fix(api, client): update Gatsby, webpack & related things (#41452)

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Mrugesh Mohapatra
2021-03-26 00:43:43 +05:30
committed by GitHub
parent 92dfb3065c
commit ad9b1f89d8
71 changed files with 35182 additions and 9001 deletions

View File

@ -1,4 +1,5 @@
const env = require('../config/env');
const webpack = require('webpack');
const { createFilePath } = require('gatsby-source-filesystem');
const uniq = require('lodash/uniq');
@ -184,6 +185,13 @@ exports.onCreateWebpackConfig = ({ stage, plugins, actions }) => {
process.env.HOME_PATH || 'http://localhost:3000'
),
STRIPE_PUBLIC_KEY: JSON.stringify(process.env.STRIPE_PUBLIC_KEY || '')
}),
// We add the shims of the node globals to the global scope
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer']
}),
new webpack.ProvidePlugin({
process: 'process/browser'
})
];
// The monaco editor relies on some browser only globals so should not be
@ -193,8 +201,17 @@ exports.onCreateWebpackConfig = ({ stage, plugins, actions }) => {
newPlugins.push(new MonacoWebpackPlugin());
}
actions.setWebpackConfig({
node: {
fs: 'empty'
resolve: {
fallback: {
fs: false,
path: false,
assert: require.resolve('assert'),
crypto: require.resolve('crypto-browserify'),
util: false,
buffer: require.resolve('buffer'),
stream: require.resolve('stream-browserify'),
process: require.resolve('process/browser')
}
},
plugins: newPlugins
});