You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you use the function format of CRACO devServer, sadly, the function is executed at runtime when the devServer proxy is created by CRA. This is too late to set an environment var and CRA doesn't acknowled the port prop of the devServer config.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
module.exports = {
/config 1/
devServer: (devServerConfig, { env, paths, proxy, allowedHost }) => {
devServerConfig.port = 3009;
return devServerConfig;
},
/config 2/
devServer: (devServerConfig, { env, paths, proxy, allowedHost }) => {
return { ...devServerConfig, port: 3009 };
},
/config 3/
devServer: {
port: 3009,
},
};
When I use config 1 or 2, the setting will not come to effect. Only config 3 works fine.
create-react-app -V
3.4.1
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"@types/jest": "^24.9.1",
"@types/node": "^12.12.47",
"@types/react": "^16.9.41",
"@types/react-dom": "^16.9.8",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1",
"typescript": "^3.7.5"
},
"devDependencies": {
"@craco/craco": "^5.6.4"
}
The text was updated successfully, but these errors were encountered: