Skip to content

Commit

Permalink
fix: CRA fix for 'axios_1.default.post is not a function
Browse files Browse the repository at this point in the history
Signed-off-by: Bucur David <dbucur22@gmail.com>
  • Loading branch information
bucurdavid committed Dec 21, 2023
1 parent 5f51d09 commit 0abac70
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 74 deletions.
41 changes: 41 additions & 0 deletions config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const getCacheIdentifier = require("react-dev-utils/getCacheIdentifier");

const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== "false";

module.exports = function override(config, webpackEnv) {
console.log("overriding webpack config...");

const isEnvDevelopment = webpackEnv === "development";
const isEnvProduction = webpackEnv === "production";
const loaders = config.module.rules[1].oneOf;

loaders.splice(loaders.length - 1, 0, {
test: /\.(js|mjs|cjs)$/,
exclude: /@babel(?:\/|\\{1,2})runtime/,
loader: require.resolve("babel-loader"),
options: {
babelrc: false,
configFile: false,
compact: false,
presets: [[require.resolve("babel-preset-react-app/dependencies"), { helpers: true }]],
cacheDirectory: true,
// See #6846 for context on why cacheCompression is disabled
cacheCompression: false,
// @remove-on-eject-begin
cacheIdentifier: getCacheIdentifier(isEnvProduction ? "production" : isEnvDevelopment && "development", [
"babel-plugin-named-asset-import",
"babel-preset-react-app",
"react-dev-utils",
"react-scripts",
]),
// @remove-on-eject-end
// Babel sourcemaps are needed for debugging into node_modules
// code. Without the options below, debuggers like VSCode
// show incorrect code and set breakpoints on the wrong lines.
sourceMaps: shouldUseSourceMap,
inputSourceMap: shouldUseSourceMap,
},
});

return config;
};
108 changes: 42 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
"@hookform/resolvers": "3.3.2",
"@itheum/sdk-mx-data-nft": "2.4.0",
"@itheum/sdk-mx-data-nft": "2.5.0",
"@itheum/sdk-mx-enterprise": "0.0.7",
"@multiversx/sdk-core": "12.17.0",
"@multiversx/sdk-dapp": "2.25.1",
"@multiversx/sdk-native-auth-client": "1.0.6",
"@multiversx/sdk-network-providers": "2.1.0",
"@multiversx/sdk-network-providers": "2.2.0",
"@sentry/react": "7.88.0",
"@tanstack/match-sorter-utils": "8.8.4",
"@tanstack/react-table": "8.10.7",
Expand All @@ -37,12 +37,12 @@
"zustand": "4.4.7"
},
"scripts": {
"start": "REACT_APP_VERSION=$npm_package_version react-scripts start",
"build": "REACT_APP_VERSION=$npm_package_version react-scripts build",
"winStart": "cross-env REACT_APP_VERSION=$npm_package_version react-scripts start",
"winBuild": "cross-env REACT_APP_VERSION=$npm_package_version react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"start": "REACT_APP_VERSION=$npm_package_version react-app-rewired start",
"build": "REACT_APP_VERSION=$npm_package_version react-app-rewired build",
"winStart": "cross-env REACT_APP_VERSION=$npm_package_version react-app-rewired start",
"winBuild": "cross-env REACT_APP_VERSION=$npm_package_version react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-app-rewired eject",
"start-flat": "npx http-server -o /flat",
"predeploy": "npm run build",
"lint": "eslint src --ext .js,.ts,.tsx",
Expand Down Expand Up @@ -84,6 +84,7 @@
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"prettier": "3.1.1",
"react-app-rewired": "^2.2.1",
"react-error-overlay": "6.0.11",
"react-scripts": "5.0.1",
"typescript": "4.9.5"
Expand Down

0 comments on commit 0abac70

Please sign in to comment.