From 427b1aa019576a6c9fd53243857de1389a80457c Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Thu, 1 Oct 2020 17:56:23 +0100 Subject: [PATCH] New dist scripts for Phaser 3D --- config/webpack.3d.dist.config.js | 58 ++++++++++++++++++++++++++++++++ config/webpack.dist.config.js | 2 +- config/webpack.fb.config.js | 2 +- config/webpack.fb.dist.config.js | 2 +- package.json | 1 + 5 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 config/webpack.3d.dist.config.js diff --git a/config/webpack.3d.dist.config.js b/config/webpack.3d.dist.config.js new file mode 100644 index 000000000..bc874f236 --- /dev/null +++ b/config/webpack.3d.dist.config.js @@ -0,0 +1,58 @@ +'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' + }, + + output: { + path: `${__dirname}/../dist/`, + filename: '[name]3d.js', + library: 'Phaser', + libraryTarget: 'umd', + umdNamedDefine: true + }, + + performance: { hints: false }, + + 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 CANVAS_RENDERER": JSON.stringify(true), + "typeof WEBGL_RENDERER": JSON.stringify(true), + "typeof EXPERIMENTAL": JSON.stringify(false), + "typeof PLUGIN_3D": JSON.stringify(true), + "typeof PLUGIN_CAMERA3D": JSON.stringify(false), + "typeof PLUGIN_FBINSTANT": JSON.stringify(false), + "typeof FEATURE_SOUND": JSON.stringify(true) + }), + + new CleanWebpackPlugin() + ] +}; diff --git a/config/webpack.dist.config.js b/config/webpack.dist.config.js index affc27c00..d2dd2e4a4 100644 --- a/config/webpack.dist.config.js +++ b/config/webpack.dist.config.js @@ -49,7 +49,7 @@ module.exports = { "typeof CANVAS_RENDERER": JSON.stringify(true), "typeof WEBGL_RENDERER": JSON.stringify(true), "typeof EXPERIMENTAL": JSON.stringify(false), - "typeof PLUGIN_3D": JSON.stringify(true), + "typeof PLUGIN_3D": JSON.stringify(false), "typeof PLUGIN_CAMERA3D": JSON.stringify(false), "typeof PLUGIN_FBINSTANT": JSON.stringify(false), "typeof FEATURE_SOUND": JSON.stringify(true) diff --git a/config/webpack.fb.config.js b/config/webpack.fb.config.js index a3f4de44a..43dbf6e0e 100644 --- a/config/webpack.fb.config.js +++ b/config/webpack.fb.config.js @@ -30,7 +30,7 @@ module.exports = { "typeof CANVAS_RENDERER": JSON.stringify(true), "typeof WEBGL_RENDERER": JSON.stringify(true), "typeof EXPERIMENTAL": JSON.stringify(false), - "typeof PLUGIN_3D": JSON.stringify(true), + "typeof PLUGIN_3D": JSON.stringify(false), "typeof PLUGIN_CAMERA3D": JSON.stringify(false), "typeof PLUGIN_FBINSTANT": JSON.stringify(true), "typeof FEATURE_SOUND": JSON.stringify(true) diff --git a/config/webpack.fb.dist.config.js b/config/webpack.fb.dist.config.js index ddeae3608..3942b3671 100644 --- a/config/webpack.fb.dist.config.js +++ b/config/webpack.fb.dist.config.js @@ -46,7 +46,7 @@ module.exports = { "typeof CANVAS_RENDERER": JSON.stringify(true), "typeof WEBGL_RENDERER": JSON.stringify(true), "typeof EXPERIMENTAL": JSON.stringify(false), - "typeof PLUGIN_3D": JSON.stringify(true), + "typeof PLUGIN_3D": JSON.stringify(false), "typeof PLUGIN_CAMERA3D": JSON.stringify(false), "typeof PLUGIN_FBINSTANT": JSON.stringify(true), "typeof FEATURE_SOUND": JSON.stringify(true) diff --git a/package.json b/package.json index a35205dee..05838df7c 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "buildfb": "webpack --config config/webpack.fb.config.js", "watchfb": "webpack --config config/webpack.fb.config.js --watch", "dist": "webpack --config config/webpack.dist.config.js", + "dist3d": "webpack --config config/webpack.3d.dist.config.js", "distfb": "webpack --config config/webpack.fb.dist.config.js", "distfull": "npm run dist && npm run distfb", "plugin.cam3d": "webpack --config plugins/camera3d/webpack.config.js",