forked from cncjs/cncjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.base.js
95 lines (94 loc) · 2.51 KB
/
webpack.config.base.js
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* eslint no-var: 0 */
var nib = require('nib');
var path = require('path');
var webpack = require('webpack');
var findImports = require('find-imports');
module.exports = {
cache: true,
target: 'web',
entry: {
app: [
path.resolve(__dirname, 'src/web/index.jsx')
],
vendor: findImports('src/web/**/*.{js,jsx}', { flatten: true })
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js')
],
module: {
preLoaders: [
// http://survivejs.com/webpack_react/linting_in_webpack/
{
test: /\.jsx?$/,
loaders: ['eslint'],
exclude: /node_modules/
},
{
test: /\.styl$/,
loader: 'stylint'
}
],
loaders: [
{
test: /\.json$/,
loader: 'json'
},
{
test: /\.jsx?$/,
loader: 'babel',
exclude: /(node_modules|bower_components)/,
query: {
env: {
development: {
presets: ['react-hmre']
}
},
presets: ['es2015', 'stage-0', 'react'],
plugins: [
'transform-decorators-legacy'
]
}
},
{
test: /\.styl$/,
loader: 'style!css!stylus'
},
{
test: /\.css$/,
loader: 'style!css'
},
{
test: /\.(png|jpg)$/,
loader: 'url',
query: {
limit: 8192
}
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url',
query: {
limit: 10000,
mimetype: 'application/font-woff'
}
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file'
}
]
},
stylus: {
// nib - CSS3 extensions for Stylus
use: [nib()],
// no need to have a '@import "nib"' in the stylesheet
import: ['~nib/lib/nib/index.styl']
},
resolve: {
alias: {},
extensions: ['', '.js', '.jsx', '.styl']
},
node: {
fs: 'empty'
}
};