Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More webpack updates - package size optimizations and long term caching #1126

Merged
merged 22 commits into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
91d37a4
webpack updates
salvatore-fxpig May 10, 2020
0fcd13d
babel preset env
salvatore-fxpig May 12, 2020
46b3ead
package size optimizations - d3-scale
salvatore-fxpig May 11, 2020
30f0e9a
package size optimizations - react-select
salvatore-fxpig May 11, 2020
5a3103d
package size optimizations - leaflet
salvatore-fxpig May 11, 2020
9c12da3
package size optimizations - locales
salvatore-fxpig May 12, 2020
9987764
package size optimization - google analytics
salvatore-fxpig May 11, 2020
12573a3
package size optimization - marked + dompurify
salvatore-fxpig May 13, 2020
1e5de96
package size optimization - papaparse
salvatore-fxpig May 13, 2020
a6a46c0
transpile node_modules with babel
salvatore-fxpig May 12, 2020
1ba8b1d
vendor bundles and hashes for long term caching
salvatore-fxpig May 12, 2020
23dea72
package size optimization - lodash
salvatore-fxpig May 14, 2020
2f30aa8
set babel env for jest
salvatore-fxpig May 14, 2020
be3ec90
explicitly search for node_modules, remove obsolete docs
salvatore-fxpig May 26, 2020
c3d4957
Update devDependencies and dependencies
salvatore-fxpig May 26, 2020
1727649
remove useless ternary
salvatore-fxpig May 26, 2020
ef6676c
move index.html to src folder
salvatore-fxpig May 26, 2020
56688a5
use async micro-bundle as entry point
salvatore-fxpig May 26, 2020
f02fc37
Update bundlesize config to reflect entry micro-chunk
salvatore-fxpig May 27, 2020
a615906
Fix chunk paths to work on Windows as well
salvatore-fxpig May 27, 2020
638b0e1
patching a couple loose ends (hot reload, en locale, exportIndexDotHtml)
salvatore-fxpig May 28, 2020
a051ec2
fix node_modules search function
salvatore-fxpig May 28, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,21 @@ const utils = require('./cli/utils');
module.exports = function babelConfig(api) {
utils.verbose(`Generating Babel Config`);
const presets = [
"@babel/env",
[
"@babel/preset-env",
{
useBuiltIns: "usage",
targets: "cover 95%",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 this covers IE9 which is still needed for Auspice

corejs: 3
}
],
"@babel/preset-react"
];
const plugins = [
["@babel/plugin-proposal-decorators", { legacy: true }],
"@babel/plugin-proposal-class-properties",
"babel-plugin-styled-components",
"babel-plugin-syntax-dynamic-import",
"@babel/plugin-transform-runtime",
"@babel/plugin-syntax-dynamic-import",
"lodash"
];
if (api.env("development")) {
Expand Down
3,031 changes: 2,371 additions & 660 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@
"@babel/plugin-proposal-class-properties": "^7.3.4",
"@babel/plugin-proposal-decorators": "^7.3.0",
"@babel/plugin-transform-runtime": "^7.8.3",
"@babel/preset-env": "^7.3.4",
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.8.7",
"@hot-loader/react-dom": "^16.13.0",
"argparse": "^1.0.10",
"awesomplete": "^1.1.2",
Expand All @@ -54,13 +52,12 @@
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-strip-function-call": "^1.0.2",
"babel-plugin-styled-components": "^1.10.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-polyfill": "^6.26.0",
"binomial": "^0.2.0",
"bundlesize": "^0.18.0",
"chalk": "^2.4.1",
"compression": "^1.7.3",
"compression-webpack-plugin": "^3.0.1",
"core-js": "^3.6.5",
"create-react-class": "^15.6.0",
"css-loader": "^2.1.1",
"d3-array": "^1.2.0",
Expand All @@ -79,9 +76,6 @@
"d3-zoom": "^1.1.3",
"dom-to-image": "^2.6.0",
"dompurify": "^2.0.7",
"es6-object-assign": "^1.1.0",
"es6-promise": "~1.0.0",
"es6-promise-polyfill": "^1.2.0",
"express": "^4.16.3",
"express-naked-redirect": "^0.1.2",
"express-static-gzip": "^0.2.2",
Expand Down Expand Up @@ -115,6 +109,7 @@
"redux": "^4.0.1",
"redux-devtools": "^3.5.0",
"redux-thunk": "^2.3.0",
"regenerator-runtime": "^0.13.5",
"request": "^2.87.0",
"run-sequence": "~0.3.6",
"style-loader": "^0.13.2",
Expand All @@ -128,6 +123,8 @@
"yaml-front-matter": "^4.0.0"
},
"devDependencies": {
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.9.6",
"chai": "^4.1.2",
"chai-http": "^4.0.0",
"eslint": "^5.14.1",
Expand Down
1 change: 0 additions & 1 deletion src/components/narrative/ReactPageScroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/* PLEASE SEE https://github.com/VikLiegostaiev/react-page-scroller */

import React from "react";
import "babel-polyfill";
import PropTypes from "prop-types"
import _ from "lodash";

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable import/first */

/* P O L Y F I L L S */
import "./util/polyfills"; // eslint-disable-line
import "whatwg-fetch"; // eslint-disable-line
/* L I B R A R I E S */
import React from "react";
import ReactDOM from "react-dom";
Expand Down
16 changes: 0 additions & 16 deletions src/util/polyfills.js

This file was deleted.

8 changes: 4 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const generateConfig = ({extensionPath, devMode=false, customOutputPath, analyze
new webpack.NoEmitOnErrorsPlugin()
] : [
pluginProcessEnvData,
new webpack.optimize.AggressiveMergingPlugin(), // merge chunks - https://github.com/webpack/docs/wiki/list-of-plugins#aggressivemergingplugin
new webpack.optimize.AggressiveMergingPlugin({minSizeReduce: 1.2}), // merge chunks - https://github.com/webpack/docs/wiki/list-of-plugins#aggressivemergingplugin
pluginCompress
];

Expand All @@ -67,9 +67,9 @@ const generateConfig = ({extensionPath, devMode=false, customOutputPath, analyze
plugins.push(new BundleAnalyzerPlugin());
}

const entry =
(devMode ? ["react-hot-loader/patch", "webpack-hot-middleware/client"] : [])
.concat(["babel-polyfill", "./src/index"]);
const entry = devMode
? ["react-hot-loader/patch", "webpack-hot-middleware/client", "./src/index"]
: ["./src/index"];

/* Where do we want the output to be saved?
* For development we use the (virtual) "devel" directory
Expand Down