2017-07-31 10:48:34 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const webpack = require('webpack');
|
2017-09-13 16:09:16 +00:00
|
|
|
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
2018-02-13 03:42:57 +00:00
|
|
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
2017-07-31 10:48:34 +00:00
|
|
|
|
2019-05-10 15:31:52 +00:00
|
|
|
const basePath = __dirname;
|
|
|
|
const targetFolder = 'dist';
|
|
|
|
|
2017-07-31 10:48:34 +00:00
|
|
|
module.exports = {
|
2018-03-20 12:24:42 +00:00
|
|
|
mode: 'production',
|
2017-07-31 10:48:34 +00:00
|
|
|
|
2019-05-08 21:38:02 +00:00
|
|
|
context: `${__dirname}/../src/`,
|
2017-07-31 10:48:34 +00:00
|
|
|
|
|
|
|
entry: {
|
2018-03-20 12:24:42 +00:00
|
|
|
phaser: './phaser.js',
|
2018-02-13 03:23:52 +00:00
|
|
|
'phaser.min': './phaser.js',
|
|
|
|
'phaser-arcade-physics': './phaser-arcade-physics.js',
|
2018-09-20 15:58:23 +00:00
|
|
|
'phaser-arcade-physics.min': './phaser-arcade-physics.js'
|
2017-07-31 10:48:34 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
output: {
|
2019-05-08 21:38:02 +00:00
|
|
|
path: `${__dirname}/../dist/`,
|
2017-07-31 10:48:34 +00:00
|
|
|
filename: '[name].js',
|
|
|
|
library: 'Phaser',
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
umdNamedDefine: true
|
|
|
|
},
|
|
|
|
|
2018-05-08 22:29:42 +00:00
|
|
|
performance: { hints: false },
|
|
|
|
|
2018-03-20 13:43:57 +00:00
|
|
|
optimization: {
|
|
|
|
minimizer: [
|
|
|
|
new UglifyJSPlugin({
|
|
|
|
include: /\.min\.js$/,
|
|
|
|
parallel: true,
|
|
|
|
sourceMap: false,
|
|
|
|
uglifyOptions: {
|
|
|
|
compress: true,
|
|
|
|
ie8: false,
|
|
|
|
ecma: 5,
|
|
|
|
output: {comments: false},
|
|
|
|
warnings: false
|
|
|
|
},
|
|
|
|
warningsFilter: () => false
|
|
|
|
})
|
|
|
|
]
|
|
|
|
},
|
2017-07-31 10:48:34 +00:00
|
|
|
|
2018-03-20 12:24:42 +00:00
|
|
|
plugins: [
|
2017-09-13 16:09:16 +00:00
|
|
|
new webpack.DefinePlugin({
|
2018-04-20 17:57:34 +00:00
|
|
|
"typeof CANVAS_RENDERER": JSON.stringify(true),
|
2018-08-23 14:30:21 +00:00
|
|
|
"typeof WEBGL_RENDERER": JSON.stringify(true),
|
2018-08-23 17:09:37 +00:00
|
|
|
"typeof EXPERIMENTAL": JSON.stringify(false),
|
2018-09-20 15:58:23 +00:00
|
|
|
"typeof PLUGIN_CAMERA3D": JSON.stringify(false),
|
2019-04-24 11:23:21 +00:00
|
|
|
"typeof PLUGIN_FBINSTANT": JSON.stringify(false),
|
|
|
|
"typeof FEATURE_SOUND": JSON.stringify(true)
|
2017-09-13 16:09:16 +00:00
|
|
|
}),
|
|
|
|
|
2019-05-10 15:31:52 +00:00
|
|
|
new CleanWebpackPlugin([targetFolder], {
|
|
|
|
root: basePath + '/../'
|
|
|
|
})
|
2017-07-31 10:48:34 +00:00
|
|
|
]
|
|
|
|
};
|