Skip to content

Instantly share code, notes, and snippets.

@timothyallan
Created January 19, 2019 03:53
Show Gist options
  • Save timothyallan/7de034a31094541e230e1b3faa2c4620 to your computer and use it in GitHub Desktop.
Save timothyallan/7de034a31094541e230e1b3faa2c4620 to your computer and use it in GitHub Desktop.
const rewire = require('rewire');
const defaults = rewire('react-scripts/scripts/start.js');
const configFactory = defaults.__get__('configFactory');
const devConfigFactory = configFactory('development');
// Do stuff
// i.e. devConfigFactory.module.rules.xxxxxx
const patchedDevConfigFactory = function() {
return devConfigFactory;
};
defaults.__set__('configFactory', patchedDevConfigFactory);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment