Created
April 1, 2020 14:45
-
-
Save k1sul1/aa0c6de94fe05b36ec3895859e4447ac to your computer and use it in GitHub Desktop.
Build create-react-app to a single file. Useful for things like WordPress plugins.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rewire = require('rewire'); | |
const defaults = rewire('react-scripts/scripts/build.js'); | |
let config = defaults.__get__('config'); | |
config.optimization.splitChunks = { | |
cacheGroups: { | |
default: false, | |
}, | |
}; | |
config.optimization.runtimeChunk = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "cra", | |
"version": "0.1.0", | |
"private": true, | |
"dependencies": { | |
"http-proxy-middleware": "^0.19.1", | |
"node-sass": "^4.13.0", | |
"react": "^16.8.4", | |
"react-dom": "^16.8.4", | |
"react-router-dom": "^4.3.1", | |
"react-scripts": "2.1.8", | |
"rewire": "^4.0.1" | |
}, | |
"homepage": "/wp-content/plugins/plugin/path/to/crabuilddir", | |
"scripts": { | |
"start": "react-scripts start", | |
"build2": "react-scripts build", | |
"build": "node ./scripts/build-non-split.js", | |
"test": "react-scripts test", | |
"eject": "react-scripts eject" | |
}, | |
"eslintConfig": { | |
"extends": "react-app" | |
}, | |
"browserslist": [ | |
">0.2%", | |
"not dead", | |
"not ie <= 11", | |
"not op_mini all" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment