Skip to content

Commit

Permalink
refactor(asset): Inline source maps to enable debug in JCEF
Browse files Browse the repository at this point in the history
The webapp is now built with a override of the default
react-script webpack config, this override disables
optimizations and inline source maps.

Workaround of facebook/create-react-app#790, by using
`react-script-rewired` and passing a custom webpack
configuration override.

The non-modifiable webpack config passed to react-script is
located here :
`excalidraw-assets/node_modules/react-scripts/config/webpack.config.js`

Related to #7
  • Loading branch information
bric3 committed Jul 1, 2021
1 parent c37a3fa commit 64fcdb0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
14 changes: 14 additions & 0 deletions excalidraw-assets/config-overrides.js
@@ -0,0 +1,14 @@
module.exports = function override(config, env) {
// see https://webpack.js.org/configuration/
console.log("Disabling build minimizer (config-overrides.js)");
config.mode = "development";
config.optimization.minimize = false;
config.optimization.minimizer = [];

// https://webpack.js.org/configuration/devtool/
console.log("Inline SourceMaps (config-overrides.js)");
config.devtool = 'inline-source-maps'


return config;
};
10 changes: 5 additions & 5 deletions excalidraw-assets/package.json
Expand Up @@ -13,6 +13,7 @@
"@types/react-dom": "^17.0.8",
"awesome-debounce-promise": "^2.1.0",
"react": "^17.0.2",
"react-app-rewired": "^2.1.8",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"typescript": "^4.3.4"
Expand All @@ -29,10 +30,9 @@
]
},
"scripts": {
"start": "BROWSER=none cross-env NODE_ENV=development react-scripts start",
"build": "BUILD_PATH=./build/react-build/ react-scripts build && npx gulp",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
"start": "BROWSER=none cross-env NODE_ENV=development react-app-rewired start",
"build": "BUILD_PATH=./build/react-build/ react-app-rewired build && npx gulp",
"test": "react-app-rewired test --env=jsdom"
},
"browserslist": {
"production": [
Expand All @@ -46,4 +46,4 @@
"last 1 safari version"
]
}
}
}
7 changes: 7 additions & 0 deletions excalidraw-assets/yarn.lock
Expand Up @@ -9700,6 +9700,13 @@ react-app-polyfill@^2.0.0:
regenerator-runtime "^0.13.7"
whatwg-fetch "^3.4.1"

react-app-rewired@^2.1.8:
version "2.1.8"
resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-2.1.8.tgz#e192f93b98daf96889418d33d3e86cf863812b56"
integrity sha512-wjXPdKPLscA7mn0I1de1NHrbfWdXz4S1ladaGgHVKdn1hTgKK5N6EdGIJM0KrS6bKnJBj7WuqJroDTsPKKr66Q==
dependencies:
semver "^5.6.0"

react-dev-utils@^11.0.3:
version "11.0.4"
resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-11.0.4.tgz#a7ccb60257a1ca2e0efe7a83e38e6700d17aa37a"
Expand Down

0 comments on commit 64fcdb0

Please sign in to comment.