2.4.1 • Published 3 years ago
react-app-rewired-dynamic v2.4.1
react-app-rewired-dynamic
can help you to fetch data before project building and inject data in builded project
just like using react-app-rewired,create config-dynamic.js file to send request and return data what you want
step1 ,create config-dynamic.js
config-dynamic.js
module.exports = async (argvs) => {
let data = await someFetch("http"//...")
return data
}
step2 ,add function in config-overrides
config-overrides.js
const { override } = require("customize-cra");
const { mergeDefine } = require("react-app-rewired-dynamic");
module.exports = override(
mergeDefine({otherStaticData : "hello"})
)
step3, the data you returned will be Assigned to global variable : process.REACT_APP_REWIRED_DYNAMIC
App.jsx
console.log(process.REACT_APP_REWIRED_DYNAMIC)
step4,package.json
"start": "react-app-rewired-dynamic start"
"build": "react-app-rewired-dynamic build"
2.4.1
3 years ago
2.4.0
3 years ago
2.3.12
3 years ago
2.3.11
3 years ago
2.3.9
3 years ago
2.3.10
3 years ago
2.3.8
3 years ago
2.3.7
3 years ago
2.3.6
3 years ago
2.3.5
3 years ago
2.3.4
3 years ago
2.3.3
3 years ago
2.3.0
3 years ago
2.2.0
3 years ago
2.3.2
3 years ago
2.3.1
3 years ago
2.1.0
3 years ago
2.0.0
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago