-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
65 lines (59 loc) · 1.8 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
"use strict";
var path = require('path');
var glob = require('glob');
var _ = require('underscore');
var entries = {};
var g = new glob.Glob('./src/js/entries/**/*.js', {
sync: true
});
g.found.forEach(function (file) {
var outputFile = file.replace('./src/js/entries/', '').replace('.js', '');
entries[outputFile] = path.resolve(__dirname, file);
});
var babelConfig = {
whitelist: [
'es6.arrowFunctions',
'es6.properties.shorthand',
'es6.properties.computed',
'es6.destructuring',
'es6.parameters.default',
'es6.parameters.rest',
'es6.templateLiterals',
'es6.blockScoping',
'runtime',
'react'
]
};
module.exports = {
cache: true,
entry: entries,
output: {
path: path.resolve(__dirname, './public'),
filename: 'compiled/js/[name].js',
sourceMapFilename: '/' + '[file].map'
},
resolve: {
unsafeCache: true,
root: path.resolve(__dirname, './src/js'),
alias: {
'@templates': path.resolve(__dirname, './public/templates'),
'@scss': path.resolve(__dirname, './src/scss')
},
extensions: ["", ".js", ".json", ".html", ".es", ".jsx"]
},
resolveLoader: { root: path.join(__dirname, "node_modules") },
module: {
loaders: [
{
test: /\.scss$/,
loader: "style!css!sass?outputStyle=expanded&includePaths[]=" + (path.resolve(__dirname, "./node_modules"))
},
{ test: /\.es|jsx$/, loader: 'babel-loader', query: babelConfig },
{ test: /\.html$/, loader: 'webpack-compile-templates' },
{ test: /\.json$/, loader: 'json' },
{ test : /\.js$/, loader: 'jstransform-loader'}
]
},
devtool: '#eval',
debug: true
};