Skip to content

Commit

Permalink
Fixed a bug loading a lazy component
Browse files Browse the repository at this point in the history
On the lazy component loading:
Even though the component was ES6, it was still necessary to import by calling default. Ref: https://webpack.js.org/migrate/4#import-and-commonjs

Disabled the web pack mode behaviour of setting the nodeEnv based on the set mode.
This is because we expect nodeEnv to have more than two possible values.

Upgraded preact compat. This was in hope to fix the lazy loading, but it probably didn’t have much effect. Still an upgrade should be better. Ref: preactjs/preact-compat#484

Updated uglify JS for the same reason that updated preact compat.
  • Loading branch information
rfreitas committed Feb 21, 2019
1 parent e821e86 commit e8f0d4f
Show file tree
Hide file tree
Showing 4 changed files with 214 additions and 66 deletions.
268 changes: 206 additions & 62 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"style-loader": "^0.23.1",
"surge": "^0.20.1",
"travis-weigh-in": "^1.0.2",
"uglifyjs-webpack-plugin": "^1.0.1",
"uglifyjs-webpack-plugin": "^2.1.1",
"webpack": "^4.29.5",
"webpack-bundle-analyzer": "^2.11.1",
"webpack-cli": "^3.2.3",
Expand All @@ -103,8 +103,8 @@
"parse-unit": "1.0.1",
"pdfobject": "2.0.201604172",
"preact": "^8.4.2",
"preact-compat": "3.16.0",
"preact-context": "^1.0.3",
"preact-compat": "^3.18.4",
"preact-context": "^1.1.3",
"raven-js": "^3.26.3",
"react-modal-onfido": "1.5.2",
"react-native-listener": "1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/components/PhoneNumberInput/Lazy.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PhoneNumberInputLazy extends Component {
// a separate bundle that can be lazy loaded on demand, to avoid bloating the loading time of the browser page

import(/* webpackChunkName: "crossDevice" */ './index.js').then(component => {
this.setState({component})
this.setState({component:component.default})
}).catch(() => props.translate('errors.lazy_loading.message'));
}

Expand Down
Loading

0 comments on commit e8f0d4f

Please sign in to comment.