-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.js
More file actions
69 lines (69 loc) · 1.57 KB
/
webpack.js
File metadata and controls
69 lines (69 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
var webpack = require('webpack')
var path = require('path')
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var autoprefixer = require('autoprefixer')
module.exports = {
context : process.cwd(),
entry : {
index : './lib/index.js'
},
output : {
filename : '[name].js',
path : path.join(process.cwd(),'/dist'),
publicPath : '/static/',
libraryTarget : 'umd',
library : '<%NAME%>'
},
externals : {
'react' : {
commonjs : 'react',
commonjs2 : 'react',
amd : 'react',
root : 'React'
},
'react-dom' : {
commonjs : 'react-dom',
commonjs2 : 'react-dom',
amd : 'react-dom',
root : 'ReactDOM'
}
},
module : {
loaders : [
{
test : /\.jsx?$/,
loader : 'babel-loader',
query : {
presets : ['es2015','react','stage-1']
},
exclude : /node_modules/
},
{
test : /\.less$/,
loader: ExtractTextPlugin.extract('css-loader!postcss-loader!less-loader'),
exclude : /node_modules/
},
{
test : /\.json/,
loader: 'json-loader!strip-json-comments'
},
{
test:/.(png)|(jpg)$/,
loader: "url-loader?limit=50000"
}]
},
plugins : [
new ExtractTextPlugin({
filename: '[name].css',
allChunks: true
}),
new webpack.ProgressPlugin((percentage, msg) => {
const stream = process.stderr;
if (stream.isTTY && percentage < 0.71) {
stream.cursorTo(0);
stream.write(`📦 ${msg}`);
stream.clearLine(1);
}
})
]
}