Skip to content

Commit 9fa1976

Browse files
committed
Make build config more generic for reuse
All package-specific information should come from package.json
1 parent fee686b commit 9fa1976

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99
"license": "MIT",
1010
"author": "Jonny Buchanan <[email protected]> (https://github.com/insin)",
1111
"scripts": {
12-
"clean": "rimraf lib dist",
1312
"build": "babel src --out-dir lib",
14-
"build:umd": "webpack src/index.js dist/react-filtered-multiselect.js && webpack src/index.js dist/react-filtered-multiselect.min.js --config=webpack.prod.config.js",
15-
"dist": "npm run lint && npm run clean && npm run build && npm run build:umd",
16-
"demo": "eslint demo/src && rimraf demo/dist && webpack --config=webpack.demo.config.js",
13+
"build:demo": "webpack --config=webpack.demo.config.js",
14+
"build:umd": "webpack && webpack --config=webpack.prod.config.js",
15+
"clean": "rimraf lib dist",
16+
"clean:demo": "rimraf demo/dist",
17+
"dist": "npm run lint && npm run clean && npm run build && npm run build:umd && npm run dist:demo",
18+
"dist:demo": "npm run lint:demo && npm run clean:demo && npm run build:demo",
1719
"lint": "eslint src",
20+
"lint:demo": "eslint demo/src",
1821
"lint:fix": "eslint src --fix",
1922
"test": "eslint ."
2023
},

webpack.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
var path = require('path')
2+
13
var webpack = require('webpack')
24

35
var pkg = require('./package.json')
@@ -25,14 +27,17 @@ if (process.env.NODE_ENV === 'production') {
2527
}
2628

2729
module.exports = {
30+
entry: path.resolve(__dirname, 'src/index.js'),
2831
module: {
2932
loaders: [
3033
{test: /\.js$/, loader: 'babel', exclude: /node_modules/}
3134
]
3235
},
3336
output: {
37+
filename: pkg.name + (process.env.NODE_ENV === 'production' ? '.min.js' : '.js'),
3438
library: pkg.standalone,
35-
libraryTarget: 'umd'
39+
libraryTarget: 'umd',
40+
path: path.resolve(__dirname, 'dist')
3641
},
3742
externals: [{
3843
'react': {

0 commit comments

Comments
 (0)