build: Build js files with webpack

This commit is contained in:
Cole Bemis 2017-07-03 15:06:40 -07:00 committed by Cole Bemis
parent 71f502fc95
commit ef3e69b327
3 changed files with 41 additions and 0 deletions

View File

@ -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: node_modules:
npm install npm install
@ -6,3 +15,9 @@ dist:
dist/icons.json: node_modules dist icons icons/*.svg dist/icons.json: node_modules dist icons icons/*.svg
./node_modules/.bin/babel-node bin/build-json.js ./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

View File

@ -7,6 +7,7 @@
"dist" "dist"
], ],
"scripts": { "scripts": {
"build": "make build",
"commitmsg": "validate-commit-msg", "commitmsg": "validate-commit-msg",
"cm": "git-cz", "cm": "git-cz",
"semantic-release": "semantic-release pre && npm publish && semantic-release post" "semantic-release": "semantic-release pre && npm publish && semantic-release post"

25
webpack.config.babel.js Normal file
View File

@ -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/,
},
],
},
};