Skip to content

Instantly share code, notes, and snippets.

View mgreer's full-sized avatar

Michael Greer mgreer

View GitHub Profile
config.optimization = {
minimizer: [
new UglifyJsPlugin({
parallel: true,
sourceMap: true,
}),
],
splitChunks: {
chunks: 'initial',
cacheGroups: {
config.optimization = {
minimizer: [
new UglifyJsPlugin({
parallel: true,
sourceMap: true,
}),
],
splitChunks: {
chunks: 'initial',
cacheGroups: {
@mgreer
mgreer / codeSplitting.js
Last active August 31, 2021 21:29
Code splitting HOC
// @flow
import * as React from 'react';
import {asyncComponent} from 'react-async-component';
export const loaderMaker = (bgColor: string = 'transparent') => () => (
<div style={{position: 'absolute', width: '100%', height: '100%', backgroundColor: bgColor}} />
);
const MAX_RETRIES = 3;
const STARTING_BACKOFF = 500;