-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.webpack.js
executable file
·56 lines (53 loc) · 1.37 KB
/
conf.webpack.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
var path = require('path');
var appConfig = require('./conf.app.js');
var conf = {
entry: {
app: './app.js'
},
externals: {
'prop-types': 'PropTypes',
'react': 'React',
'react-dom': 'ReactDOM'
},
output: {
//filename: 'lib.[name].js', // name the file under a namespace
filename: '[name].js',
library: ['lib', '[name]'], // expose exported item to window
libraryTarget: 'umd',
path: appConfig.paths.PUBLIC_JS,
publicPath: '/js/',
umdNamedDefine: true
},
module: {
loaders: [
// pre-process `.styl` files with Stylus
{
test: /\.styl$/,
loader: 'style-loader!css-loader!stylus-loader'
},
// transpile React components
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
include: [
path.resolve(appConfig.paths.ROOT, './app.js'),
appConfig.paths.SOURCE_JS
],
query: {
plugins: ['es6-promise'],
presets: ['es2015', 'react']
}
}
]
},
resolve: {
alias: {}
}
};
// Add paths to webpack as alias'. This will allow us to `import` or `require` a
// path via a constant rather than having to use `../../etc/`.
for(var path in appConfig.paths){
conf.resolve.alias[path] = appConfig.paths[path];
}
module.exports = conf;