From e0b3e11767815198a87afc4217106fae2f59696b Mon Sep 17 00:00:00 2001 From: james hadfield Date: Thu, 31 Jan 2019 19:58:02 +1300 Subject: [PATCH 1/3] Implmement code splitting using lazy loading We now have basic code-splitting in place for a handful of components. This means that (e.g.) the code for the main interactive page is not fetched for display of the splash page. This reduces (initial) bundle sizes and should make for quicker load time. --- babel.config.js | 3 +- index.html | 4 +- package-lock.json | 7 +++- package.json | 59 ++++++++++++++------------- src/actions/navigation.js | 6 ++- src/components/datasetLoader/index.js | 31 ++++---------- src/components/framework/spinner.js | 15 +++++++ src/components/main/index.js | 22 ++++++++-- src/root.js | 41 ++++++++++++++----- webpack.config.js | 7 ++-- 10 files changed, 118 insertions(+), 77 deletions(-) create mode 100644 src/components/framework/spinner.js diff --git a/babel.config.js b/babel.config.js index d40c7427a..e201dc72c 100644 --- a/babel.config.js +++ b/babel.config.js @@ -15,7 +15,8 @@ module.exports = function babelConfig(api) { const plugins = [ ["@babel/plugin-proposal-decorators", { legacy: true }], "@babel/plugin-proposal-class-properties", - "babel-plugin-styled-components" + "babel-plugin-styled-components", + "babel-plugin-syntax-dynamic-import" ]; if (api.env("development")) { if (process.env.BABEL_EXTENSION_PATH && !process.env.BABEL_EXTENSION_PATH.includes(__dirname)) { diff --git a/index.html b/index.html index fd07cea28..51edb2c96 100644 --- a/index.html +++ b/index.html @@ -12,8 +12,8 @@
- - + +