2017-07-31 10:48:34 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const webpack = require('webpack');
|
|
|
|
const WebpackShellPlugin = require('webpack-shell-plugin');
|
2017-09-13 16:09:16 +00:00
|
|
|
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
2017-07-31 10:48:34 +00:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
|
|
|
context: `${__dirname}/src/`,
|
|
|
|
|
|
|
|
entry: {
|
2017-07-31 13:23:28 +00:00
|
|
|
phaser: './phaser.js',
|
|
|
|
'phaser.min': './phaser.js'
|
2017-07-31 10:48:34 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
output: {
|
|
|
|
path: `${__dirname}/dist/`,
|
|
|
|
filename: '[name].js',
|
|
|
|
library: 'Phaser',
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
umdNamedDefine: true
|
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
|
|
|
|
2017-09-13 16:09:16 +00:00
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'CANVAS_RENDERER': JSON.stringify(true),
|
|
|
|
'WEBGL_RENDERER': JSON.stringify(true)
|
|
|
|
}),
|
|
|
|
|
2017-07-31 10:48:34 +00:00
|
|
|
new UglifyJSPlugin({
|
2017-07-31 13:23:28 +00:00
|
|
|
include: /\.min\.js$/,
|
2017-07-31 10:48:34 +00:00
|
|
|
parallel: true,
|
2017-09-13 16:09:16 +00:00
|
|
|
sourceMap: false,
|
2017-07-31 10:48:34 +00:00
|
|
|
uglifyOptions: {
|
2017-02-12 14:49:58 +00:00
|
|
|
compress: true,
|
2017-07-31 10:48:34 +00:00
|
|
|
ie8: false,
|
|
|
|
ecma: 5,
|
2017-02-12 14:49:58 +00:00
|
|
|
output: {
|
|
|
|
comments: false
|
|
|
|
},
|
2017-07-31 10:48:34 +00:00
|
|
|
warnings: false
|
|
|
|
},
|
|
|
|
warningsFilter: (src) => false
|
|
|
|
}),
|
|
|
|
|
|
|
|
new WebpackShellPlugin({
|
|
|
|
onBuildStart: 'node create-checksum.js'
|
|
|
|
})
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
};
|