From ef3e69b3271ee4a4463378188423419542b85a18 Mon Sep 17 00:00:00 2001
From: Cole Bemis <colebemis@gmail.com>
Date: Mon, 3 Jul 2017 15:06:40 -0700
Subject: [PATCH] build: Build js files with webpack

---
 Makefile                | 15 +++++++++++++++
 package.json            |  1 +
 webpack.config.babel.js | 25 +++++++++++++++++++++++++
 3 files changed, 41 insertions(+)
 create mode 100644 webpack.config.babel.js

diff --git a/Makefile b/Makefile
index db1f22b..de3d3bc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,12 @@
+src_files := src/*.js
+src_dir   := src
+
+.PHONY: all build
+
+all: build
+
+build: dist/feather.js dist/feather.min.js
+
 node_modules:
 	npm install
 
@@ -6,3 +15,9 @@ dist:
 
 dist/icons.json: node_modules dist icons icons/*.svg
 	./node_modules/.bin/babel-node bin/build-json.js
+
+dist/feather.js: dist/icons.json $(src_dir) $(src_files)
+	./node_modules/.bin/webpack --output-filename feather.js
+
+dist/feather.min.js: dist/icons.json $(src_dir) $(src_files)
+	./node_modules/.bin/webpack --output-filename feather.min.js -p
diff --git a/package.json b/package.json
index 55876c6..c0b4f6b 100644
--- a/package.json
+++ b/package.json
@@ -7,6 +7,7 @@
     "dist"
   ],
   "scripts": {
+    "build": "make build",
     "commitmsg": "validate-commit-msg",
     "cm": "git-cz",
     "semantic-release": "semantic-release pre && npm publish && semantic-release post"
diff --git a/webpack.config.babel.js b/webpack.config.babel.js
new file mode 100644
index 0000000..2ffc849
--- /dev/null
+++ b/webpack.config.babel.js
@@ -0,0 +1,25 @@
+import path from 'path';
+
+export default {
+  entry: [
+    'core-js/fn/array/from',
+    'core-js/fn/object/assign',
+    'core-js/fn/set',
+    path.resolve(__dirname, 'src/index.js'),
+  ],
+  output: {
+    path: path.resolve(__dirname, 'dist'),
+    libraryTarget: 'umd',
+    library: 'feather',
+  },
+  devtool: 'source-map',
+  module: {
+    rules: [
+      {
+        test: /\.js$/,
+        loader: 'babel-loader',
+        exclude: /node_modules/,
+      },
+    ],
+  },
+};
-- 
2.21.0