fix: Remove unused polyfills and update build config

Removes polyfills for `Object.assign` and `Set` which, as far as I can tell, are unused in the
codebase. Updates `webpack` from 3 to 4. Replaces `babel-preset-es2015` with `babel-preset-env`.
Reduces the minified bundle size (`feather.min.js`) by **9.3kB** (72.4kB to 63.1kB). Does not change
any functionality of the library.
This commit is contained in:
Cole Bemis 2018-05-18 12:26:21 -07:00
parent bd129d9dcf
commit c978b1cb4e
5 changed files with 4659 additions and 346 deletions

View File

@ -1,4 +1,13 @@
{
"presets": ["es2015"],
"plugins": ["transform-object-rest-spread"]
"presets": [
[
"env",
{
"targets": {
"browsers": ["last 2 versions"]
}
}
],
"stage-2"
]
}

View File

@ -21,5 +21,5 @@ mkdir dist/icons
./node_modules/.bin/babel-node bin/build-svgs.js
# Build JavaScript library
./node_modules/.bin/webpack --output-filename feather.js
./node_modules/.bin/webpack --output-filename feather.min.js -p
./node_modules/.bin/webpack --output-filename feather.js --mode development
./node_modules/.bin/webpack --output-filename feather.min.js --mode production

4965
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,8 @@
]
},
"dependencies": {
"classnames": "^2.2.5"
"classnames": "^2.2.5",
"core-js": "^2.5.3"
},
"devDependencies": {
"@commitlint/cli": "^5.2.5",
@ -35,12 +36,10 @@
"algoliasearch": "^3.27.1",
"babel-cli": "^6.24.1",
"babel-loader": "^7.1.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-2": "^6.24.1",
"cheerio": "^1.0.0-rc.2",
"commitizen": "^2.9.6",
"core-js": "^2.5.3",
"cz-conventional-changelog": "^2.1.0",
"eslint": "^4.15.0",
"eslint-config-airbnb-base": "^12.1.0",
@ -56,7 +55,8 @@
"rimraf": "^2.6.2",
"semantic-release": "^12.2.2",
"svgo": "^0.7.2",
"webpack": "^3.10.0"
"webpack": "^4.8.3",
"webpack-cli": "^2.1.3"
},
"repository": {
"type": "git",

View File

@ -1,12 +1,7 @@
import path from 'path';
const path = require('path');
export default {
entry: [
'core-js/fn/array/from',
'core-js/fn/object/assign',
'core-js/fn/set',
path.resolve(__dirname, 'src/index.js'),
],
module.exports = {
entry: ['core-js/fn/array/from', path.resolve(__dirname, 'src/index.js')],
output: {
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'umd',