This repository has been archived by the owner on Jun 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
webpack.config.js
116 lines (106 loc) · 3.76 KB
/
webpack.config.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
var _ = require( 'lodash' );
var path = require( 'path' );
var webpack = require( 'webpack' );
var pathAppTo;
function pathTo() {
return path.join( __dirname, 'src', path.join.apply( path, arguments ) );
}
pathAppTo = _.partial( pathTo, 'app' );
module.exports = function ( options ) {
var config = _.merge( {}, {
entry: {
vendor: [
'bootstrap/dist/js/bootstrap.min.js',
'assets/css/theme.css',
'assets/css/animate.css',
'font-awesome/css/font-awesome.min.css',
'react-dropzone-component/node_modules/dropzone/dist/dropzone.css',
'assets/css/filepicker.css',
'checkit',
'classnames',
'events',
'jquery',
'lib/animatedModal.js',
'lib/growl.js',
'bootstrap-markdown/js/bootstrap-markdown',
'load-script',
'lodash',
'griddle-react',
'marked',
'moment',
'react',
'react/addons',
'react-bootstrap',
'react-cookie',
'react-ga',
'react-doc-meta',
'react-dropzone-component',
'react-pager',
'react-portal',
'react-router',
'react-social',
'react-textarea-autosize',
'reflux',
'url',
'when'
]
},
output: {
path: path.join( __dirname, 'bundle' ),
filename: 'app.js',
publicPath: '/bundle/'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.ProvidePlugin( {
jQuery: 'jquery',
$: 'jquery',
'window.jQuery': 'jquery'
} ),
new webpack.ProvidePlugin( {
React: 'react',
'window.React': 'react'
} ),
new webpack.optimize.CommonsChunkPlugin( 'vendor', 'vendor.js' )
],
resolve: {
extensions: [ '', '.js', '.jsx' ],
alias: {
//application aliases
actions: pathAppTo( 'actions' ),
components: pathAppTo( 'components' ),
lib: pathAppTo( 'lib' ),
mixins: pathAppTo( 'mixins' ),
modals: pathAppTo( 'modals' ),
models: pathAppTo( 'models' ),
resources: pathAppTo( 'resources' ),
services: pathAppTo( 'services' ),
stores: pathAppTo( 'stores' ),
views: pathAppTo( 'views' ),
utils: pathAppTo( 'utils' ),
assets: pathTo( 'assets' ),
config: pathAppTo( 'config.js' ),
//vendor aliases
jquery: 'jquery/dist/jquery.min.js'
}
},
module: {
loaders: [
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff' },
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file-loader' },
{
test: /\.jpg|\.png|\.mp3/,
loader: 'file-loader'
}
]
},
resolveLoader: {
root: path.join( __dirname, 'node_modules' )
}
}, options.overrides );
config.module.loaders = _.union( config.module.loaders, options.loaders );
config.plugins = _.union( config.plugins, options.plugins );
return config;
};