forked from bernatmv/phaserito
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
61 lines (59 loc) · 1.92 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
var fs = require('fs');
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var StatsPlugin = require('stats-webpack-plugin');
var isDirectory = function (file) {
return fs.statSync(path.join('./src/games/', file)).isDirectory();
};
module.exports = {
cache: false,
context: path.join(__dirname, 'src'),
entry: {
'vendor': [
'phaser'
],
'src/js': './js/main.js'
},
output: {
path: path.join(__dirname, './build'),
publicPath: '/',
filename: 'js/app.min.js'
},
module: {
loaders: [
{ test: /\.js$/i, exclude: /node_modules/i, loader: 'traceur?experimental&arrayComprehension&runtime' },
{ test: /(phaser-arcade-physics|phaser-debug)(\.min)?\.js$/i, loader: 'script' },
{ test: /\.json$/i, exclude: /\.audiosprite\.json$/i, loader: 'json' },
{ test: /\.css$/i, loader: 'style!css' },
{ test: /\.less$/i, loader: 'style!css!less' },
{ test: /\.(jpe?g|png|gif)$/i, loader: 'image?bypassOnDebug&name=[path][name].[ext]?[hash]' },
{ test: /\.(mp3|ac3|ogg|m4a)$/i, loader: 'file?name=[path][name].[ext]?[hash]' },
{ test: /\.(ttf|woff|eot)$/i, loader: 'file?name=[path][name].[ext]?[hash]' },
{ test: /\.audiosprite\.json$/i, loader: 'file?name=[path][name].[ext]?[hash]' }
]
},
resolve: {
alias: {
'phaserito': path.join(__dirname, 'src/lib/main.js'),
'phaser': path.join(__dirname, 'node_modules/phaser/dist/phaser-arcade-physics.js'),
'phaser-debug': path.join(__dirname, 'node_modules/phaser-debug/dist/phaser-debug.js')
},
extensions: ['', '.js']
},
plugins: [
new webpack.ProvidePlugin({
console: 'imports?this=>window!exports?window.console!console-polyfill',
Promise: 'bluebird',
Phaserito: 'phaserito'
}),
new StatsPlugin(path.join(__dirname, 'stats.json')),
new HtmlWebpackPlugin({
config: {
googleAnalytics: "UA-58578359-1"
},
template: 'src/index.html',
filename: 'index.html'
})
]
};