Skip to content

Commit 64fcdb0

Browse files
committed
refactor(asset): Inline source maps to enable debug in JCEF
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
1 parent c37a3fa commit 64fcdb0

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

excalidraw-assets/config-overrides.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = function override(config, env) {
2+
// see https://webpack.js.org/configuration/
3+
console.log("Disabling build minimizer (config-overrides.js)");
4+
config.mode = "development";
5+
config.optimization.minimize = false;
6+
config.optimization.minimizer = [];
7+
8+
// https://webpack.js.org/configuration/devtool/
9+
console.log("Inline SourceMaps (config-overrides.js)");
10+
config.devtool = 'inline-source-maps'
11+
12+
13+
return config;
14+
};

excalidraw-assets/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"@types/react-dom": "^17.0.8",
1414
"awesome-debounce-promise": "^2.1.0",
1515
"react": "^17.0.2",
16+
"react-app-rewired": "^2.1.8",
1617
"react-dom": "^17.0.2",
1718
"react-scripts": "4.0.3",
1819
"typescript": "^4.3.4"
@@ -29,10 +30,9 @@
2930
]
3031
},
3132
"scripts": {
32-
"start": "BROWSER=none cross-env NODE_ENV=development react-scripts start",
33-
"build": "BUILD_PATH=./build/react-build/ react-scripts build && npx gulp",
34-
"test": "react-scripts test --env=jsdom",
35-
"eject": "react-scripts eject"
33+
"start": "BROWSER=none cross-env NODE_ENV=development react-app-rewired start",
34+
"build": "BUILD_PATH=./build/react-build/ react-app-rewired build && npx gulp",
35+
"test": "react-app-rewired test --env=jsdom"
3636
},
3737
"browserslist": {
3838
"production": [
@@ -46,4 +46,4 @@
4646
"last 1 safari version"
4747
]
4848
}
49-
}
49+
}

excalidraw-assets/yarn.lock

+7
Original file line numberDiff line numberDiff line change
@@ -9700,6 +9700,13 @@ react-app-polyfill@^2.0.0:
97009700
regenerator-runtime "^0.13.7"
97019701
whatwg-fetch "^3.4.1"
97029702

9703+
react-app-rewired@^2.1.8:
9704+
version "2.1.8"
9705+
resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-2.1.8.tgz#e192f93b98daf96889418d33d3e86cf863812b56"
9706+
integrity sha512-wjXPdKPLscA7mn0I1de1NHrbfWdXz4S1ladaGgHVKdn1hTgKK5N6EdGIJM0KrS6bKnJBj7WuqJroDTsPKKr66Q==
9707+
dependencies:
9708+
semver "^5.6.0"
9709+
97039710
react-dev-utils@^11.0.3:
97049711
version "11.0.4"
97059712
resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-11.0.4.tgz#a7ccb60257a1ca2e0efe7a83e38e6700d17aa37a"

0 commit comments

Comments
 (0)