mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
65 lines
1.6 KiB
JavaScript
65 lines
1.6 KiB
JavaScript
'use strict';
|
|
|
|
const webpack = require('webpack');
|
|
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
|
|
|
module.exports = {
|
|
mode: 'production',
|
|
|
|
context: `${__dirname}/src/`,
|
|
|
|
entry: {
|
|
phaser: './phaser.js',
|
|
'phaser.min': './phaser.js',
|
|
'phaser-arcade-physics': './phaser-arcade-physics.js',
|
|
'phaser-arcade-physics.min': './phaser-arcade-physics.js',
|
|
'phaser-core': './phaser-core.js',
|
|
'phaser-core.min': './phaser-core.js'
|
|
},
|
|
|
|
output: {
|
|
path: `${__dirname}/dist/`,
|
|
filename: '[name].js',
|
|
library: 'Phaser',
|
|
libraryTarget: 'umd',
|
|
umdNamedDefine: true
|
|
},
|
|
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: [ /\.vert$/, /\.frag$/ ],
|
|
use: 'raw-loader'
|
|
}
|
|
]
|
|
},
|
|
|
|
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
|
|
})
|
|
]
|
|
},
|
|
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
"typeof SHADER_REQUIRE": JSON.stringify(false),
|
|
"typeof CANVAS_RENDERER": JSON.stringify(true),
|
|
"typeof WEBGL_RENDERER": JSON.stringify(true)
|
|
}),
|
|
|
|
new CleanWebpackPlugin([ 'dist' ])
|
|
]
|
|
};
|