aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vnext/package.json5
-rw-r--r--vnext/src/index.js15
-rw-r--r--vnext/src/style/main.css4
-rw-r--r--vnext/src/views/index.html4
-rw-r--r--vnext/webpack.config.js27
-rw-r--r--vnext/yarn.lock14
6 files changed, 50 insertions, 19 deletions
diff --git a/vnext/package.json b/vnext/package.json
index ca08ce44..965e2997 100644
--- a/vnext/package.json
+++ b/vnext/package.json
@@ -14,6 +14,7 @@
"@babel/core": "7.1.0",
"@babel/plugin-proposal-class-properties": "7.1.0",
"@babel/plugin-proposal-object-rest-spread": "7.0.0",
+ "@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/preset-env": "7.1.0",
"@babel/preset-react": "7.0.0",
"autoprefixer": "^9.1.5",
@@ -61,7 +62,8 @@
{
"useBuiltIns": true
}
- ]
+ ],
+ "@babel/plugin-syntax-dynamic-import"
],
"presets": [
"@babel/preset-env",
@@ -77,6 +79,7 @@
"react-content-loader": "^3.1.2",
"react-cookies": "^0.1.0",
"react-dom": "^16.5.1",
+ "react-loadable": "^5.5.0",
"react-router-dom": "^4.3.1"
}
}
diff --git a/vnext/src/index.js b/vnext/src/index.js
index 24fe9352..74e36d84 100644
--- a/vnext/src/index.js
+++ b/vnext/src/index.js
@@ -1,11 +1,14 @@
import React from 'react';
import ReactDOM from 'react-dom';
+import Loadable from 'react-loadable';
-import App from './App';
+const Juick = Loadable({
+ loader: () => import('./App'),
+ loading: () => <div>Loading...</div>
+});
-let container = document.createElement('div');
-ReactDOM.render(<App />, container);
-let body = document.getElementById('content').parentNode;
-body.replaceChild(container.getElementsByTagName('header')[0], body.querySelector('#header'));
-body.replaceChild(container.querySelector('#content'), body.querySelector('#content'));
+const JuickApp = () => (
+ <Juick />
+);
+ReactDOM.render(<JuickApp />, document.getElementById('body'));
diff --git a/vnext/src/style/main.css b/vnext/src/style/main.css
index 6d78c7eb..77cc56cb 100644
--- a/vnext/src/style/main.css
+++ b/vnext/src/style/main.css
@@ -87,7 +87,7 @@ noscript article {
background: #006699;
color: #fff;
}
-body > header {
+#body > header {
position: fixed;
top: 0;
width: 100%;
@@ -138,7 +138,7 @@ body > header {
min-width: 310px;
width: auto;
}
- body > header {
+ #body > header {
margin-bottom: 15px;
}
}
diff --git a/vnext/src/views/index.html b/vnext/src/views/index.html
index e5862bc1..f9fb7e72 100644
--- a/vnext/src/views/index.html
+++ b/vnext/src/views/index.html
@@ -42,7 +42,8 @@
</script>
</head>
-<body id="body">
+<body>
+ <div id="body">
<div id="header">
<div id="header_wrapper">
<div id="logo"><a href="/">Juick</a></div>
@@ -56,6 +57,7 @@
</article>
</noscript>
</div>
+ </div>
<div id="footer">
<div id="footer-right"> &middot;
<a href="/help/contacts" rel="nofollow">Contacts</a> &middot;
diff --git a/vnext/webpack.config.js b/vnext/webpack.config.js
index 4e55bbab..de878586 100644
--- a/vnext/webpack.config.js
+++ b/vnext/webpack.config.js
@@ -76,15 +76,26 @@ module.exports = {
new OptimizeCSSAssetsPlugin({})
],
splitChunks: {
- cacheGroups: {
- vendor: {
- test: /node_modules/,
- chunks: 'initial',
- name: 'vendor',
- enforce: true
- },
- }
+ chunks: 'all',
+ minSize: 30000,
+ maxSize: 0,
+ minChunks: 1,
+ maxAsyncRequests: 5,
+ maxInitialRequests: 3,
+ automaticNameDelimiter: '~',
+ name: true,
+ cacheGroups: {
+ vendors: {
+ test: /[\\/]node_modules[\\/]/,
+ priority: -10
+ },
+ default: {
+ minChunks: 2,
+ priority: -20,
+ reuseExistingChunk: true
}
+ }
+ }
},
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
diff --git a/vnext/yarn.lock b/vnext/yarn.lock
index c4de01c3..19beb079 100644
--- a/vnext/yarn.lock
+++ b/vnext/yarn.lock
@@ -286,6 +286,12 @@
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
+"@babel/plugin-syntax-dynamic-import@^7.0.0":
+ version "7.0.0"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.0.0.tgz#6dfb7d8b6c3be14ce952962f658f3b7eb54c33ee"
+ dependencies:
+ "@babel/helper-plugin-utils" "^7.0.0"
+
"@babel/plugin-syntax-json-strings@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.0.0.tgz#0d259a68090e15b383ce3710e01d5b23f3770cbd"
@@ -6210,7 +6216,7 @@ prompts@^0.1.9:
clorox "^1.0.1"
sisteransi "^0.1.0"
-prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2:
+prop-types@^15.5.0, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2:
version "15.6.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz#05d5ca77b4453e985d60fc7ff8c859094a497102"
dependencies:
@@ -6407,6 +6413,12 @@ react-is@^16.5.1:
version "16.5.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.5.1.tgz#c6e8734fd548a22e1cef4fd0833afbeb433b85ee"
+react-loadable@^5.5.0:
+ version "5.5.0"
+ resolved "https://registry.yarnpkg.com/react-loadable/-/react-loadable-5.5.0.tgz#582251679d3da86c32aae2c8e689c59f1196d8c4"
+ dependencies:
+ prop-types "^15.5.0"
+
react-router-dom@^4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.3.1.tgz#4c2619fc24c4fa87c9fd18f4fb4a43fe63fbd5c6"