mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
ad09c4039a
* fix: only update editable strategies if index is less than 0 * fix: add wdyr * fix: set tracking to false as default * chore: update readme
38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
const presetReact = require('@babel/preset-react').default;
|
|
const presetCRA = require('babel-preset-react-app');
|
|
|
|
module.exports = {
|
|
babel: {
|
|
loaderOptions: (babelLoaderOptions, { env, paths }) => {
|
|
const origBabelPresetReactAppIndex = babelLoaderOptions.presets.findIndex(
|
|
preset => {
|
|
return preset[0].includes('babel-preset-react-app');
|
|
}
|
|
);
|
|
|
|
if (origBabelPresetReactAppIndex === -1) {
|
|
return babelLoaderOptions;
|
|
}
|
|
|
|
const overridenBabelPresetReactApp = (...args) => {
|
|
const babelPresetReactAppResult = presetCRA(...args);
|
|
const origPresetReact = babelPresetReactAppResult.presets.find(
|
|
preset => {
|
|
return preset[0] === presetReact;
|
|
}
|
|
);
|
|
Object.assign(origPresetReact[1], {
|
|
importSource: '@welldone-software/why-did-you-render',
|
|
});
|
|
return babelPresetReactAppResult;
|
|
};
|
|
|
|
babelLoaderOptions.presets[
|
|
origBabelPresetReactAppIndex
|
|
] = overridenBabelPresetReactApp;
|
|
|
|
return babelLoaderOptions;
|
|
},
|
|
},
|
|
};
|