2017-07-31 10:48:34 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const webpack = require('webpack');
|
2021-09-21 13:41:11 +00:00
|
|
|
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
|
|
|
|
2023-03-22 16:04:57 +00:00
|
|
|
module.exports = [
|
|
|
|
{
|
|
|
|
name: 'phaser-umd',
|
|
|
|
mode: 'production',
|
2017-07-31 10:48:34 +00:00
|
|
|
|
2023-03-22 16:04:57 +00:00
|
|
|
context: `${__dirname}/../src/`,
|
2017-07-31 10:48:34 +00:00
|
|
|
|
2023-03-22 16:04:57 +00:00
|
|
|
entry: {
|
|
|
|
phaser: './phaser.js',
|
|
|
|
'phaser.min': './phaser.js',
|
|
|
|
'phaser-arcade-physics': './phaser-arcade-physics.js',
|
|
|
|
'phaser-arcade-physics.min': './phaser-arcade-physics.js',
|
|
|
|
'phaser-ie9': './phaser-ie9.js',
|
|
|
|
'phaser-ie9.min': './phaser-ie9.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({
|
2024-02-21 13:23:52 +00:00
|
|
|
"typeof CANVAS_RENDERER": JSON.stringify(true),
|
|
|
|
"typeof WEBGL_RENDERER": JSON.stringify(true),
|
|
|
|
"typeof WEBGL_DEBUG": JSON.stringify(false),
|
|
|
|
"typeof EXPERIMENTAL": JSON.stringify(false),
|
|
|
|
"typeof PLUGIN_3D": JSON.stringify(false),
|
|
|
|
"typeof PLUGIN_CAMERA3D": JSON.stringify(false),
|
|
|
|
"typeof PLUGIN_FBINSTANT": JSON.stringify(false),
|
|
|
|
"typeof FEATURE_SOUND": JSON.stringify(true)
|
2023-03-22 16:04:57 +00:00
|
|
|
}),
|
|
|
|
|
|
|
|
new CleanWebpackPlugin()
|
2018-03-20 13:43:57 +00:00
|
|
|
]
|
|
|
|
},
|
2023-03-22 16:04:57 +00:00
|
|
|
{
|
|
|
|
experiments: {
|
|
|
|
outputModule: true,
|
|
|
|
},
|
2017-07-31 10:48:34 +00:00
|
|
|
|
2023-03-22 16:04:57 +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 PLUGIN_3D": JSON.stringify(false),
|
|
|
|
"typeof PLUGIN_CAMERA3D": JSON.stringify(false),
|
|
|
|
"typeof PLUGIN_FBINSTANT": JSON.stringify(false),
|
|
|
|
"typeof FEATURE_SOUND": JSON.stringify(true)
|
|
|
|
})
|
|
|
|
]
|
|
|
|
}
|
|
|
|
];
|