mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 06:30:38 +00:00
1484d8251b
Build now puts dev files in `build` folder instead, which is excluded from npm.
62 lines
1.4 KiB
JavaScript
62 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
const webpack = require('webpack');
|
|
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
|
|
|
module.exports = {
|
|
|
|
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'
|
|
},
|
|
|
|
output: {
|
|
path: `${__dirname}/dist/`,
|
|
filename: '[name].js',
|
|
library: 'Phaser',
|
|
libraryTarget: 'umd',
|
|
umdNamedDefine: true
|
|
},
|
|
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: [ /\.vert$/, /\.frag$/ ],
|
|
use: 'raw-loader'
|
|
}
|
|
]
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
'CANVAS_RENDERER': JSON.stringify(true),
|
|
'WEBGL_RENDERER': JSON.stringify(true)
|
|
}),
|
|
|
|
new CleanWebpackPlugin(['dist']),
|
|
|
|
new UglifyJSPlugin({
|
|
include: /\.min\.js$/,
|
|
parallel: true,
|
|
sourceMap: false,
|
|
uglifyOptions: {
|
|
compress: true,
|
|
ie8: false,
|
|
ecma: 5,
|
|
output: {
|
|
comments: false
|
|
},
|
|
warnings: false
|
|
},
|
|
warningsFilter: (src) => false
|
|
})
|
|
|
|
]
|
|
|
|
};
|