phaser/webpack.dist.config.js

63 lines
1.5 KiB
JavaScript
Raw Normal View History

2017-07-31 10:48:34 +00:00
'use strict';
const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
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
context: `${__dirname}/src/`,
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',
'phaser-arcade-physics.min': './phaser-arcade-physics.js'
2017-07-31 10:48:34 +00:00
},
output: {
path: `${__dirname}/dist/`,
filename: '[name].js',
library: 'Phaser',
libraryTarget: 'umd',
umdNamedDefine: true
},
2018-01-30 13:30:40 +00:00
module: {
rules: [
2018-03-20 12:24:42 +00:00
{
test: [ /\.vert$/, /\.frag$/ ],
use: 'raw-loader'
}
2018-01-30 13:30:40 +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: [
new webpack.DefinePlugin({
2018-03-20 12:24:42 +00:00
CANVAS_RENDERER: JSON.stringify(true),
WEBGL_RENDERER: JSON.stringify(true)
}),
new CleanWebpackPlugin([ 'dist' ])
2017-07-31 10:48:34 +00:00
]
};