Skip to content

Commit dd2c20a

Browse files
author
Kent C. Dodds
committed
add webpack ✨
1 parent e8f1be8 commit dd2c20a

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
"main": "dist/index.js",
66
"scripts": {
77
"prebuild": "rimraf dist",
8-
"build": "babel --copy-files --out-dir dist --ignore *.test.js src",
8+
"build": "npm-run-all --parallel build:*",
9+
"build:main": "babel --copy-files --out-dir dist --ignore *.test.js src",
10+
"build:umd": "webpack --output-filename index.umd.js",
11+
"build:umd.min": "webpack --output-filename index.umd.min.js -p",
912
"test": "cross-env NODE_ENV=test nyc mocha",
1013
"watch:test": "mocha --watch",
1114
"lint": "eslint src",
@@ -33,6 +36,7 @@
3336
},
3437
"devDependencies": {
3538
"babel-cli": "6.11.4",
39+
"babel-loader": "6.2.4",
3640
"babel-plugin-istanbul": "1.0.3",
3741
"babel-preset-es2015": "6.9.0",
3842
"babel-register": "6.11.6",
@@ -41,10 +45,12 @@
4145
"eslint": "3.2.0",
4246
"eslint-config-kentcdodds": "^9.0.0",
4347
"ghooks": "1.3.2",
48+
"json-loader": "0.5.4",
4449
"mocha": "3.0.0",
4550
"npm-run-all": "2.3.0",
4651
"nyc": "7.1.0",
47-
"rimraf": "2.5.4"
52+
"rimraf": "2.5.4",
53+
"webpack": "1.13.1"
4854
},
4955
"nyc": {
5056
"all": true,

webpack.config.babel.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {join} from 'path'
2+
3+
const context = join(__dirname, 'src')
4+
5+
export default {
6+
context,
7+
entry: './index',
8+
output: {
9+
path: join(__dirname, 'dist'),
10+
libraryTarget: 'umd',
11+
library: 'starWarsNames',
12+
},
13+
devtool: 'source-map',
14+
module: {
15+
loaders: [
16+
{test: /\.js$/, loaders: ['babel'], include: context},
17+
{test: /\.json$/, loaders: ['json'], include: context},
18+
],
19+
},
20+
}

0 commit comments

Comments
 (0)