Skip to content

Commit d13a288

Browse files
committed
Add "sideEffects" for webpack tree-shaking & Use lodash-webpack-plugin & Upgrade dependencies & Bump version
1 parent 31725b6 commit d13a288

File tree

7 files changed

+57
-89
lines changed

7 files changed

+57
-89
lines changed

package.json

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-cool-starter",
3-
"version": "2.5.1",
3+
"version": "2.5.2",
44
"description": "A starter boilerplate for an universal web application with the best development experience and best practices.",
55
"main": "index.js",
66
"engines": {
@@ -32,10 +32,11 @@
3232
],
3333
"author": "WellyShen <hivoid19@gmail.com> (https://github.com/wellyshen)",
3434
"license": "MIT",
35+
"homepage": "https://github.com/wellyshen/react-cool-starter",
3536
"bugs": {
3637
"url": "https://github.com/wellyshen/react-cool-starter/issues"
3738
},
38-
"homepage": "https://github.com/wellyshen/react-cool-starter",
39+
"sideEffects": false,
3940
"scripts": {
4041
"dev": "better-npm-run dev",
4142
"start": "better-npm-run start",
@@ -144,13 +145,11 @@
144145
"eslintConfig": {
145146
"parser": "babel-eslint",
146147
"extends": [
147-
"plugin:lodash-fp/recommended",
148148
"airbnb",
149149
"prettier",
150150
"prettier/react"
151151
],
152152
"plugins": [
153-
"lodash-fp",
154153
"react",
155154
"prettier"
156155
],
@@ -196,8 +195,6 @@
196195
]
197196
}
198197
],
199-
"lodash-fp/use-fp": "off",
200-
"lodash-fp/consistent-name": "off",
201198
"prettier/prettier": [
202199
"error",
203200
{
@@ -284,7 +281,7 @@
284281
"babel-plugin-transform-remove-console": "^6.9.4",
285282
"better-npm-run": "^0.1.0",
286283
"chalk": "^2.4.1",
287-
"compression": "^1.7.2",
284+
"compression": "^1.7.3",
288285
"cross-spawn": "^6.0.5",
289286
"css-modules-require-hook": "^4.2.3",
290287
"express": "^4.16.3",
@@ -316,7 +313,6 @@
316313
"devDependencies": {
317314
"@babel/cli": "^7.0.0-beta.53",
318315
"@babel/core": "^7.0.0-beta.53",
319-
"@babel/plugin-external-helpers": "^7.0.0-beta.53",
320316
"babel-core": "^7.0.0-bridge.0",
321317
"babel-eslint": "^8.2.6",
322318
"babel-jest": "^23.4.0",
@@ -334,7 +330,6 @@
334330
"eslint-loader": "^2.0.0",
335331
"eslint-plugin-import": "^2.12.0",
336332
"eslint-plugin-jsx-a11y": "^6.0.3",
337-
"eslint-plugin-lodash-fp": "^2.2.0-a1",
338333
"eslint-plugin-prettier": "^2.6.2",
339334
"eslint-plugin-react": "^7.9.1",
340335
"file-loader": "^1.1.11",
@@ -343,6 +338,7 @@
343338
"identity-obj-proxy": "^3.0.0",
344339
"imagemin-webpack-plugin": "^2.1.5",
345340
"jest": "^23.4.1",
341+
"lodash-webpack-plugin": "^0.11.5",
346342
"mini-css-extract-plugin": "^0.4.1",
347343
"nock": "^9.4.2",
348344
"nodemon": "^1.18.2",
@@ -362,7 +358,7 @@
362358
"stylelint-scss": "^3.1.3",
363359
"stylelint-webpack-plugin": "^0.10.5",
364360
"url-loader": "^1.0.1",
365-
"webpack": "^4.16.0",
361+
"webpack": "^4.16.1",
366362
"webpack-bundle-analyzer": "^2.13.1",
367363
"webpack-cli": "^3.0.8",
368364
"webpack-dev-middleware": "^3.1.3",

public/webpack-assets.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"vendors~main.css": "/assets/0.fec759bc.chunk.css",
3-
"vendors~main.js": "/assets/0.6eb50866.chunk.js",
4-
"vendors~main.js.map": "/assets/0.6eb50866.chunk.js.map",
5-
"main.css": "/assets/main.f1573851.css",
6-
"main.js": "/assets/main.e5919db2.js",
7-
"main.js.map": "/assets/main.e5919db2.js.map"
2+
"vendors~main.css": "/assets/1.c5e26978.chunk.css",
3+
"vendors~main.js": "/assets/1.688cde24.chunk.js",
4+
"vendors~main.js.map": "/assets/1.688cde24.chunk.js.map",
5+
"main.css": "/assets/main.dbaa56e0.css",
6+
"main.js": "/assets/main.955839ce.js",
7+
"main.js.map": "/assets/main.955839ce.js.map"
88
}

src/config/prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* @flow */
22

3-
const fp = require('lodash/fp');
3+
const _ = require('lodash');
44

55
const defaultConfig = require('./default');
66

7-
module.exports = fp.merge(defaultConfig, {
7+
module.exports = _.merge(defaultConfig, {
88
// Over write default settings here...
99
});

src/reducers/home.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* @flow */
22

3-
import fp from 'lodash/fp';
3+
import _ from 'lodash';
44

55
import type { Home, Action } from '../types';
66

@@ -15,16 +15,16 @@ const initialState = {
1515
export default (state: State = initialState, action: Action): State => {
1616
switch (action.type) {
1717
case 'USERS_REQUESTING':
18-
return fp.assign(state, {
18+
return _.assign({}, state, {
1919
readyStatus: 'USERS_REQUESTING'
2020
});
2121
case 'USERS_FAILURE':
22-
return fp.assign(state, {
22+
return _.assign({}, state, {
2323
readyStatus: 'USERS_FAILURE',
2424
err: action.err
2525
});
2626
case 'USERS_SUCCESS':
27-
return fp.assign(state, {
27+
return _.assign({}, state, {
2828
readyStatus: 'USERS_SUCCESS',
2929
list: action.data
3030
});

src/reducers/userInfo.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* @flow */
22

3-
import fp from 'lodash/fp';
3+
import _ from 'lodash';
44

55
import type { UserInfo, Action } from '../types';
66

@@ -9,20 +9,20 @@ type State = UserInfo;
99
export default (state: State = {}, action: Action): State => {
1010
switch (action.type) {
1111
case 'USER_REQUESTING':
12-
return fp.assign(state, {
12+
return _.assign({}, state, {
1313
[action.userId]: {
1414
readyStatus: 'USER_REQUESTING'
1515
}
1616
});
1717
case 'USER_FAILURE':
18-
return fp.assign(state, {
18+
return _.assign({}, state, {
1919
[action.userId]: {
2020
readyStatus: 'USER_FAILURE',
2121
err: action.err
2222
}
2323
});
2424
case 'USER_SUCCESS':
25-
return fp.assign(state, {
25+
return _.assign({}, state, {
2626
[action.userId]: {
2727
readyStatus: 'USER_SUCCESS',
2828
info: action.data

tools/webpack/config.babel.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import webpack from 'webpack';
33
import ManifestPlugin from 'webpack-manifest-plugin';
44
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
55
import OptimizeCssAssetsPlugin from 'optimize-css-assets-webpack-plugin';
6+
import LodashModuleReplacementPlugin from 'lodash-webpack-plugin';
67
import StyleLintPlugin from 'stylelint-webpack-plugin';
78
import CompressionPlugin from 'compression-webpack-plugin';
89
import ImageminPlugin from 'imagemin-webpack-plugin';
@@ -61,6 +62,8 @@ const getPlugins = () => {
6162
}),
6263
// Minimizing style for production
6364
new OptimizeCssAssetsPlugin(),
65+
// Smaller modular Lodash build
66+
new LodashModuleReplacementPlugin(),
6467
// Plugin to compress images with imagemin
6568
// Check "https://github.com/Klathmon/imagemin-webpack-plugin" for more configurations
6669
new ImageminPlugin({
@@ -138,10 +141,13 @@ module.exports = {
138141
plugins: [
139142
'react-hot-loader/babel',
140143
'loadable-components/babel',
141-
'@babel/plugin-external-helpers',
142144
'lodash'
143145
],
144-
env: { production: { plugins: ['transform-remove-console'] } }
146+
env: {
147+
production: {
148+
plugins: ['transform-remove-console']
149+
}
150+
}
145151
}
146152
},
147153
{

0 commit comments

Comments
 (0)