Skip to content

Commit

Permalink
fixes #24570 - dynamicailly import password strength component
Browse files Browse the repository at this point in the history
this reduced the vendor file by about 800kb and reduce
every full page reload by about 100ms on my machine

more benchmark in the PR
  • Loading branch information
ohadlevy committed Apr 29, 2019
1 parent d74dc42 commit 4ee934a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion config/webpack.vendor.js
Expand Up @@ -11,7 +11,6 @@ module.exports = [
'react-ellipsis-with-tooltip',
'react-numeric-input',
'react-onclickoutside',
'react-password-strength',
'patternfly-react',
'react-redux',
'redux',
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -100,6 +100,7 @@
"react-dom": "^16.8.1",
"react-ellipsis-with-tooltip": "^1.0.8",
"react-intl": "^2.8.0",
"react-loadable": "^5.5.0",
"react-numeric-input": "^2.0.7",
"react-onclickoutside": "^6.6.2",
"react-password-strength": "^2.4.0",
Expand Down
@@ -1,5 +1,7 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import Loadable from 'react-loadable';
import { LoadingState } from 'patternfly-react';

import * as actions from './PasswordStrengthActions';
import {
Expand All @@ -8,7 +10,11 @@ import {
} from './PasswordStrengthSelectors';
import reducer from './PasswordStrengthReducer';

import PasswordStrength from './PasswordStrength';
const PasswordStrength = Loadable({
loader: () =>
import(/* webpackChunkName: 'passwordStrength' */ './PasswordStrength'),
loading: LoadingState,
});

// map state to props
const mapStateToProps = ({ passwordStrength }) => ({
Expand Down

0 comments on commit 4ee934a

Please sign in to comment.