phaser/webpack.dist.config.js

63 lines
1.3 KiB
JavaScript
Raw Normal View History

2017-07-31 10:48:34 +00:00
'use strict';
const webpack = require('webpack');
const WebpackShellPlugin = require('webpack-shell-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
2017-07-31 10:48:34 +00:00
module.exports = {
context: `${__dirname}/src/`,
entry: {
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
},
2018-01-30 13:30:40 +00:00
module: {
rules: [
{
test: [ /\.vert$/, /\.frag$/ ],
use: 'raw-loader'
}
]
},
2017-07-31 10:48:34 +00:00
plugins: [
new webpack.DefinePlugin({
'CANVAS_RENDERER': JSON.stringify(true),
'WEBGL_RENDERER': JSON.stringify(true)
}),
2017-07-31 10:48:34 +00:00
new UglifyJSPlugin({
include: /\.min\.js$/,
2017-07-31 10:48:34 +00:00
parallel: true,
sourceMap: false,
2017-07-31 10:48:34 +00:00
uglifyOptions: {
compress: true,
2017-07-31 10:48:34 +00:00
ie8: false,
ecma: 5,
output: {
comments: false
},
2017-07-31 10:48:34 +00:00
warnings: false
},
warningsFilter: (src) => false
}),
new WebpackShellPlugin({
onBuildStart: 'node create-checksum.js'
})
]
};