Skip to content

Commit

Permalink
Install react-app-rewired and add config
Browse files Browse the repository at this point in the history
  • Loading branch information
Odisseuss committed Jan 7, 2021
1 parent 2b4c4f6 commit d79b491
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 3 deletions.
41 changes: 41 additions & 0 deletions package-lock.json

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

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,31 @@
"@types/react": "^16.14.2",
"@types/react-dom": "^16.9.10",
"@types/react-router-dom": "^5.1.7",
"comlink": "^4.3.0",
"fast-text-encoding": "^1.0.3",
"framer-motion": "^2.9.5",
"react": "^17.0.1",
"react-app-rewired": "^2.1.8",
"react-dom": "^17.0.1",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
"styled-components": "^5.2.1",
"typescript": "^4.1.2",
"wav-decoder": "^1.3.0",
"web-vitals": "^0.2.4"
"web-vitals": "^0.2.4",
"worker-loader": "^3.0.7"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "jest --watchAll --detectOpenHandles --config=jest.config.js",
"eject": "react-scripts eject",
"asbuild:untouched": "asc assembly/index.ts --target debug",
"asbuild:optimized": "asc assembly/index.ts --target release",
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
"asbuild:watch": "onchange -i 'assembly/**/*' -- npm run asbuild"
},
"config-overrides-path": "react-app-rewired.config.js",
"eslintConfig": {
"extends": [
"react-app",
Expand Down
20 changes: 20 additions & 0 deletions react-app-rewired.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* React App Rewired Config
*/
module.exports = {
// Update webpack config to use custom loader for worker files
webpack: (config) => {
// Note: It's important that the "worker-loader" gets defined BEFORE the TypeScript loader!
config.module.rules.unshift({
test: /\.worker\.ts$/,
use: {
loader: "worker-loader",
options: {
// Use directory structure & typical names of chunks produces by "react-scripts"
filename: "static/js/[name].[contenthash:8].js",
},
},
});
return config;
},
};

0 comments on commit d79b491

Please sign in to comment.