phaser/config/webpack.dist.config.js

121 lines
3.3 KiB
JavaScript
Raw Normal View History

2017-07-31 10:48:34 +00:00
'use strict';
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
2020-07-13 15:32:10 +00:00
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
2019-05-10 15:31:52 +00:00
module.exports = [
{
name: 'phaser-umd',
mode: 'production',
2017-07-31 10:48:34 +00:00
context: `${__dirname}/../src/`,
2017-07-31 10:48:34 +00:00
entry: {
phaser: './phaser.js',
'phaser.min': './phaser.js',
'phaser-arcade-physics': './phaser-arcade-physics.js',
2024-11-14 11:40:26 +00:00
'phaser-arcade-physics.min': './phaser-arcade-physics.js'
},
output: {
path: `${__dirname}/../dist/`,
filename: '[name].js',
globalObject: 'this',
library: {
name: 'Phaser',
type: 'umd',
umdNamedDefine: true,
}
},
performance: { hints: false },
optimization: {
minimizer: [
new TerserPlugin({
include: /\.min\.js$/,
parallel: true,
extractComments: false,
terserOptions: {
format: {
comments: false
},
compress: true,
ie8: false,
ecma: 5,
warnings: false
}
})
]
},
plugins: [
new webpack.DefinePlugin({
"typeof CANVAS_RENDERER": JSON.stringify(true),
"typeof WEBGL_RENDERER": JSON.stringify(true),
"typeof WEBGL_DEBUG": JSON.stringify(false),
"typeof EXPERIMENTAL": JSON.stringify(false),
"typeof FEATURE_SOUND": JSON.stringify(true)
}),
new CleanWebpackPlugin()
]
},
{
experiments: {
outputModule: true,
},
2017-07-31 10:48:34 +00:00
name: 'phaser-esm',
mode: 'production',
dependencies: [ 'phaser-umd' ],
context: `${__dirname}/../src/`,
entry: {
'phaser.esm': './phaser-esm.js',
'phaser.esm.min': './phaser-esm.js'
},
output: {
path: `${__dirname}/../dist/`,
filename: '[name].js',
library: {
type: 'module'
}
},
performance: { hints: false },
optimization: {
minimizer: [
new TerserPlugin({
include: /\.min\.js$/,
parallel: true,
extractComments: false,
terserOptions: {
format: {
comments: false
},
compress: true,
ie8: false,
ecma: 6,
warnings: false
}
})
]
},
plugins: [
new webpack.DefinePlugin({
"typeof CANVAS_RENDERER": JSON.stringify(true),
"typeof WEBGL_RENDERER": JSON.stringify(true),
"typeof WEBGL_DEBUG": JSON.stringify(false),
"typeof EXPERIMENTAL": JSON.stringify(false),
"typeof FEATURE_SOUND": JSON.stringify(true)
})
]
}
];