Permalink
Browse files

refactor(bundle): avoid lodash duplication

  • Loading branch information...
axe312ger committed Aug 17, 2017
1 parent db204ed commit f22bc6f2edb9f713eeb4e2f9917bdb6ef6978b49
Showing with 16 additions and 3 deletions.
  1. +2 −1 .babelrc
  2. +2 −0 package.json
  3. +12 −2 webpack.config.js
View
@@ -2,7 +2,8 @@
"plugins": [
"transform-class-properties",
"transform-object-rest-spread",
"date-fns"
"date-fns",
"lodash"
],
"presets": [
"preact",
View
@@ -26,6 +26,7 @@
"babel-eslint": "^7.2.1",
"babel-loader": "^7.1.1",
"babel-plugin-date-fns": "^0.1.0",
"babel-plugin-lodash": "^3.2.11",
"babel-plugin-transform-async-to-generator": "^6.22.0",
"babel-plugin-transform-class-properties": "^6.23.0",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
@@ -50,6 +51,7 @@
"koa-compress": "^2.0.0",
"koa-mount": "^3.0.0",
"koa-static": "^4.0.1",
"lodash-webpack-plugin": "^0.11.4",
"nodemon": "^1.11.0",
"postcss": "^6.0.8",
"postcss-browser-reporter": "^0.5.0",
View
@@ -3,6 +3,7 @@ const { join, resolve } = require('path')
const Webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin')
const config = require('sane-config')
const { webpackSource, webpackDestination, webpackPublicPath } = config.paths
@@ -117,7 +118,15 @@ const webpackConfig = {
],
alias: {
'react': 'preact-compat',
'react-dom': 'preact-compat'
'react-dom': 'preact-compat',
'lodash-es': 'lodash',
'lodash.get': 'lodash/get',
'lodash.isfunction': 'lodash/isFunction',
'lodash.isobject': 'lodash/isObject',
'lodash.merge': 'lodash/merge',
'lodash.reduce': 'lodash/reduce',
'lodash.set': 'lodash/set',
'lodash.unset': 'lodash/unset'
}
},
plugins: [
@@ -131,7 +140,8 @@ const webpackConfig = {
new Webpack.DefinePlugin({
APP_CONFIG: JSON.stringify(config)
}),
new ExtractTextPlugin('styles.css')
new ExtractTextPlugin('styles.css'),
new LodashModuleReplacementPlugin()
]
}

0 comments on commit f22bc6f

Please sign in to comment.