diff --git a/client/routes/PDP/index.js b/client/routes/PDP/index.js index bad7cab..cdbde74 100644 --- a/client/routes/PDP/index.js +++ b/client/routes/PDP/index.js @@ -1,14 +1,9 @@ -import React from 'react'; -import { object } from 'prop-types'; +import loadable from '@loadable/component'; -import PdpComponent from './components'; +const errorLoading = err => console.log('PDP page loading failed!', err); -const PDP = ({ match }) => { - return () -}; +const PDPComponent = loadable(() => + import(/* webpackChunkName: "pdp" */ './components').catch(errorLoading), +); -PDP.propTypes = { - match: object.isRequired, -}; - -export default PDP; +export default PDPComponent; diff --git a/package.json b/package.json index a149a4e..ba6bf97 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,6 @@ "unfetch": "^4.1.0", "url-loader": "1.1.2", "url-polyfill": "^1.1.7", - "vanilla-lazyload": "11.0.6", "webpack": "4.29.6", "webpack-dev-server": "3.8.0", "webpack-manifest-plugin": "2.0.4", diff --git a/tools/client/webpack.config.babel.js b/tools/client/webpack.config.babel.js index 19ca824..fd44473 100644 --- a/tools/client/webpack.config.babel.js +++ b/tools/client/webpack.config.babel.js @@ -406,6 +406,8 @@ module.exports = function() { color: '#61dafb', }), + new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), + new FriendlyErrorsWebpackPlugin(), // Generates an `index.html` or `index.client.html` file with the