Skip to content

Commit ceeffb2

Browse files
committed
Add webpack.config.js
1 parent 2887af7 commit ceeffb2

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

webpack.config.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
var pkg = require('./package.json');
2+
var path = require('path');
3+
var webpack = require('webpack');
4+
var ExtractTextPlugin = require('extract-text-webpack-plugin');
5+
var nib = require('nib');
6+
7+
module.exports = {
8+
devtool: 'source-map',
9+
entry: {
10+
'react-buttons': path.resolve(__dirname, 'src/index.js')
11+
},
12+
output: {
13+
path: path.join(__dirname, 'lib'),
14+
filename: 'index.js',
15+
libraryTarget: 'commonjs2'
16+
},
17+
externals: Object.keys(pkg.dependencies),
18+
module: {
19+
preLoaders: [
20+
// http://survivejs.com/webpack_react/linting_in_webpack/
21+
{
22+
test: /\.jsx?$/,
23+
loaders: ['eslint'],
24+
exclude: /node_modules/
25+
},
26+
{
27+
test: /\.styl$/,
28+
loader: 'stylint'
29+
}
30+
],
31+
loaders: [
32+
{
33+
test: /\.json$/,
34+
loader: 'json'
35+
},
36+
{
37+
test: /\.jsx?$/,
38+
loader: 'babel',
39+
exclude: /(node_modules|bower_components)/
40+
},
41+
{
42+
test: /\.styl$/,
43+
loader: ExtractTextPlugin.extract(
44+
'style',
45+
'css?-autoprefixer&modules&importLoaders=1&localIdentName=buttons---[local]---[hash:base64:5]!stylus'
46+
)
47+
},
48+
{
49+
test: /\.css$/,
50+
loader: 'style!css?-autoprefixer'
51+
}
52+
]
53+
},
54+
stylus: {
55+
// nib - CSS3 extensions for Stylus
56+
use: [nib()],
57+
// no need to have a '@import "nib"' in the stylesheet
58+
import: ['~nib/lib/nib/index.styl']
59+
},
60+
plugins: [
61+
new ExtractTextPlugin('../dist/react-buttons.css')
62+
],
63+
resolve: {
64+
extensions: ['', '.js', '.jsx']
65+
}
66+
};

0 commit comments

Comments
 (0)