forked from okfn-brasil/cuidando2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
86 lines (81 loc) · 2.85 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
var webpack = require('webpack')
function getConfig() {
var env = process.env.CONFIG_FILE_ENV
var configFile = ''
if (env) {
configFile = 'config_' + env + '.js'
} else {
configFile = 'config.js'
}
console.log("Using this config file: ", configFile)
return __dirname + '/configs/' + configFile
}
module.exports = {
cache: true,
resolve: { alias: {config: getConfig(),
assets: __dirname + '/assets/'} },
entry: {
app: './src/index.js',
vendor: './src/vendor.js',
},
output: {
path: './dist/',
publicPath: '/dist/',
filename: 'bundle.js'
},
module: {
// preLoaders: [
// { test: /\.html$/, include: /src/, loader: 'riotjs', query: { type: 'babel' } },
// ],
loaders: [
// { test: /\.png$/, include: /assets/, loader: "file" },
{ test: /\.png$/, include: /node_modules/, loader: "file" },
// { test: /\.(png|otf|svg)$/, loader: "file" },
{ test: /\.css$/, loader: 'style!css' },
{ test: /\.scss$/, include: /src/, loader: 'style!css!sass' },
{ test: /\.sass$/, include: /src/, loader: 'style!css!sass?indentedSyntax' },
// { test: /\.html$/, include: /src/, loader: 'riotjs' },
// { test: /\.js$/, exclude: /\.es5\.js$/, include: /src/, loader: 'babel' },
{
test: /\.html$/,
include: /src/,
loader: 'riotjs',
query: { type: 'babel' }
},
{
test: /\.js$/,
exclude: /\.es5\.js$/,
// include: /src/,
include: [ /configs/, /src/ ],
loader: 'babel',
query: {
presets: ['es2015-riot'],
plugins: ['syntax-async-functions', 'transform-regenerator']
}
// query: {
// modules: 'common',
// // loose: ['es6.classes'],
// // loose: ['all'],
// // optional: 'runtime',
// }
}
// { test: /\.js$|\.html$/, exclude: /\.es5\.js$/, include: [ /configs/, /src/ ], loader: 'babel', query: { presets: 'es2015-riot' } },
// ,{ test: /\.(png|otf|svg)$/, include: /assets/, loader: "url-loader?limit=100000" }
,{ test: /cluster\.svg$/, include: /assets/, loader: "url?limit=100000" }
]
},
plugins: [
new webpack.ProvidePlugin({
riot: 'riot',
leaflet: 'leaflet',
// regeneratorRuntime: 'regeneratorRuntime',
}),
new webpack.optimize.CommonsChunkPlugin(
/* chunkName= */"vendor",
/* filename= */"vendor.bundle.js")
],
devServer: {
port: 5001
},
devtool: "source-map"
}