Skip to content
This repository has been archived by the owner on Aug 30, 2020. It is now read-only.

Commit

Permalink
feat: add pdp chunk & optimize moment plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
josteph authored and sibrha committed Aug 25, 2020
1 parent 1d4a35c commit 9cc7898
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
17 changes: 6 additions & 11 deletions client/routes/PDP/index.js
Original file line number Diff line number Diff line change
@@ -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 (<PdpComponent match={match}/>)
};
const PDPComponent = loadable(() =>
import(/* webpackChunkName: "pdp" */ './components').catch(errorLoading),
);

PDP.propTypes = {
match: object.isRequired,
};

export default PDP;
export default PDPComponent;
2 changes: 2 additions & 0 deletions tools/client/webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <script> injected.
new HtmlWebpackPlugin(
Expand Down

0 comments on commit 9cc7898

Please sign in to comment.