From 53a0408b64ca281aed5a5b68d0a22f89204dc306 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Thu, 12 Oct 2023 15:19:59 +0100 Subject: [PATCH] Create webpack-nospector.config.js --- config/webpack-nospector.config.js | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 config/webpack-nospector.config.js diff --git a/config/webpack-nospector.config.js b/config/webpack-nospector.config.js new file mode 100644 index 000000000..c423eba35 --- /dev/null +++ b/config/webpack-nospector.config.js @@ -0,0 +1,60 @@ +'use strict'; + +const webpack = require('webpack'); +const exec = require('child_process').exec; + +module.exports = [ + + { + mode: 'development', + + context: `${__dirname}/../src/`, + + entry: { + phaser: './phaser.js' + }, + + devtool: 'source-map', + + output: { + path: `${__dirname}/../build/`, + globalObject: 'this', + sourceMapFilename: '[file].map', + devtoolModuleFilenameTemplate: 'webpack:///[resource-path]', // string + devtoolFallbackModuleFilenameTemplate: 'webpack:///[resource-path]?[hash]', // string + filename: '[name].js', + library: { + name: 'Phaser', + type: 'umd', + umdNamedDefine: true, + } + }, + + performance: { hints: 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(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) + }), + { + apply: (compiler) => { + compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => { + exec('node scripts/copy-to-examples-watch.js', (err, stdout, stderr) => { + if (stdout) process.stdout.write(stdout); + if (stderr) process.stderr.write(stderr); + }); + }); + } + } + ], + + devtool: 'source-map' + } +];