From 1d48f7574e3513258d7a0297c12a1ef6b88231c6 Mon Sep 17 00:00:00 2001 From: renanpvaz Date: Mon, 9 Oct 2017 13:12:33 -0300 Subject: [PATCH 1/6] load babel only when needed --- src/html.js | 8 -------- src/layouts/index.js | 18 +++++++++++------- src/site-constants.js | 4 +++- src/templates/home.js | 12 ++++++++---- src/utils/loadScript.js | 21 +++++++++++++++++++++ 5 files changed, 43 insertions(+), 20 deletions(-) create mode 100644 src/utils/loadScript.js diff --git a/src/html.js b/src/html.js index 5e186dd6..26621d72 100644 --- a/src/html.js +++ b/src/html.js @@ -20,11 +20,6 @@ if (process.env.NODE_ENV === `production`) { } } -const JS_NPM_URLS = [ - '//unpkg.com/docsearch.js@2.4.1/dist/cdn/docsearch.min.js', - '//unpkg.com/babel-standalone@6.26.0/babel.min.js', -]; - export default class HTML extends Component { render() { let css; @@ -37,8 +32,6 @@ export default class HTML extends Component { ); } - const js = JS_NPM_URLS.map(url =>