Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Created May 17, 2019 17:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BetterProgramming/43bd30b2dbaf539aad03e6d331afca30 to your computer and use it in GitHub Desktop.
Save BetterProgramming/43bd30b2dbaf539aad03e6d331afca30 to your computer and use it in GitHub Desktop.
module.exports = {
webpack: function (config, env) {
return config;
},
jest: function (config) {
return config;
},
// configFunction is the original react-scripts function that creates the
// Webpack Dev Server config based on the settings for proxy/allowedHost.
// react-scripts injects this into your function (so you can use it to
// create the standard config to start from), and needs to receive back a
// function that takes the same arguments as the original react-scripts
// function so that it can be used as a replacement for the original one.
devServer: function (configFunction) {
return function(proxy, allowedHost) {
const config = configFunction(proxy, allowedHost);
// Edit config here - example: set your own certificates.
//
// const fs = require('fs');
// config.https = {
// key: fs.readFileSync(process.env.REACT_HTTPS_KEY, 'utf8'),
// cert: fs.readFileSync(process.env.REACT_HTTPS_CERT, 'utf8'),
// ca: fs.readFileSync(process.env.REACT_HTTPS_CA, 'utf8'),
// passphrase: process.env.REACT_HTTPS_PASS
// };
config.headers = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,PUT,POST,DELETE",
"Access-Control-Allow-Headers": "Content-Type"
}
return config;
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment