Skip to content

Commit

Permalink
chore(deps): update react-scripts (#1969)
Browse files Browse the repository at this point in the history
* chore(deps): update react-scripts

* chore(deps): fix webpack 5 polyfills issues

* chore(deps): fix eslint

thanks tjaddison!
@see https://tjaddison.com/blog/2021/03/updating-babel-eslint-to-babeleslint-parser-for-react-apps/

* chore(lint): fix eslint. build succeeds with errors

errors seem to be caused by open issue with webpack5 and react-scripts
@see facebook/create-react-app#11752

* fix: npm run test:unit

* fix: npm run build

* chore: remove unused patch-package patches

* chore: fix package.json formatting

* fix: undo direct browserify import changes

* fix: webpack fallbacks
  • Loading branch information
SgtPooki authored Jul 21, 2022
1 parent f15818d commit 136b260
Show file tree
Hide file tree
Showing 11 changed files with 41,402 additions and 31,122 deletions.
8 changes: 7 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module.exports = {
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false,
babelOptions: {
presets: ['@babel/preset-react']
}
},
extends: ['react-app', 'standard', 'plugin:jsx-a11y/recommended'],
plugins: ['jsx-a11y'],
// ignore .ts files because it fails to parse it.
Expand Down
30 changes: 30 additions & 0 deletions config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* upgrading to react-scripts v5 with any sort of decent sized app causes all kinds of errors
*
* @see https://github.com/facebook/create-react-app/issues/11756#issuecomment-1184657437
* @see https://alchemy.com/blog/how-to-polyfill-node-core-modules-in-webpack-5
*/
const webpack = require('webpack');

module.exports = function override(config) {

const fallback = config.resolve.fallback || {};

Object.assign(fallback, {
"assert": require.resolve('./src/webpack-fallbacks/assert'),
"stream": require.resolve('./src/webpack-fallbacks/stream'),
"os": require.resolve('./src/webpack-fallbacks/os'),
"path": require.resolve('./src/webpack-fallbacks/path'),
})

config.resolve.fallback = fallback;

config.plugins = (config.plugins || []).concat([
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer']
})
])

return config;
}
Loading

0 comments on commit 136b260

Please sign in to comment.