Skip to content

Commit

Permalink
Updated webpack config DefinePlugin use and corresponding defs to all…
Browse files Browse the repository at this point in the history
…ow those crazy souls who import source directly on node to have a better life #6644
  • Loading branch information
photonstorm committed Feb 21, 2024
1 parent 4a85524 commit 7aaa976
Show file tree
Hide file tree
Showing 57 changed files with 135 additions and 135 deletions.
16 changes: 8 additions & 8 deletions config/webpack-nospector.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ module.exports = [

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)
CANVAS_RENDERER: JSON.stringify(true),
WEBGL_RENDERER: JSON.stringify(true),
WEBGL_DEBUG: JSON.stringify(false),
EXPERIMENTAL: JSON.stringify(true),
PLUGIN_3D: JSON.stringify(false),
PLUGIN_CAMERA3D: JSON.stringify(false),
PLUGIN_FBINSTANT: JSON.stringify(false),
FEATURE_SOUND: JSON.stringify(true)
}),
{
apply: (compiler) => {
Expand Down
16 changes: 8 additions & 8 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ module.exports = [

plugins: [
new webpack.DefinePlugin({
"typeof CANVAS_RENDERER": JSON.stringify(true),
"typeof WEBGL_RENDERER": JSON.stringify(true),
"typeof WEBGL_DEBUG": JSON.stringify(true),
"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)
CANVAS_RENDERER: JSON.stringify(true),
WEBGL_RENDERER: JSON.stringify(true),
WEBGL_DEBUG: JSON.stringify(true),
EXPERIMENTAL: JSON.stringify(true),
PLUGIN_3D: JSON.stringify(false),
PLUGIN_CAMERA3D: JSON.stringify(false),
PLUGIN_FBINSTANT: JSON.stringify(false),
FEATURE_SOUND: JSON.stringify(true)
}),
{
apply: (compiler) => {
Expand Down
16 changes: 8 additions & 8 deletions config/webpack.dist.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ module.exports = [

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)
CANVAS_RENDERER: JSON.stringify(true),
WEBGL_RENDERER: JSON.stringify(true),
WEBGL_DEBUG: JSON.stringify(false),
EXPERIMENTAL: JSON.stringify(false),
PLUGIN_3D: JSON.stringify(false),
PLUGIN_CAMERA3D: JSON.stringify(false),
PLUGIN_FBINSTANT: JSON.stringify(false),
FEATURE_SOUND: JSON.stringify(true)
}),

new CleanWebpackPlugin()
Expand Down
14 changes: 7 additions & 7 deletions config/webpack.fb.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ module.exports = {

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(false),
"typeof PLUGIN_CAMERA3D": JSON.stringify(false),
"typeof PLUGIN_FBINSTANT": JSON.stringify(true),
"typeof FEATURE_SOUND": JSON.stringify(true)
CANVAS_RENDERER: JSON.stringify(true),
WEBGL_RENDERER: JSON.stringify(true),
EXPERIMENTAL: JSON.stringify(false),
PLUGIN_3D: JSON.stringify(false),
PLUGIN_CAMERA3D: JSON.stringify(false),
PLUGIN_FBINSTANT: JSON.stringify(true),
FEATURE_SOUND: JSON.stringify(true)
}),
{
apply: (compiler) => {
Expand Down
14 changes: 7 additions & 7 deletions config/webpack.fb.dist.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ module.exports = {

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(false),
"typeof PLUGIN_CAMERA3D": JSON.stringify(false),
"typeof PLUGIN_FBINSTANT": JSON.stringify(true),
"typeof FEATURE_SOUND": JSON.stringify(true)
CANVAS_RENDERER: JSON.stringify(true),
WEBGL_RENDERER: JSON.stringify(true),
EXPERIMENTAL: JSON.stringify(false),
PLUGIN_3D: JSON.stringify(false),
PLUGIN_CAMERA3D: JSON.stringify(false),
PLUGIN_FBINSTANT: JSON.stringify(true),
FEATURE_SOUND: JSON.stringify(true)
})
]
};
6 changes: 3 additions & 3 deletions src/core/CreateRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ var CreateRenderer = function (game)
var CanvasRenderer;
var WebGLRenderer;

if (typeof WEBGL_RENDERER && typeof CANVAS_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined' && typeof CANVAS_RENDERER !== 'undefined')
{
CanvasRenderer = require('../renderer/canvas/CanvasRenderer');
WebGLRenderer = require('../renderer/webgl/WebGLRenderer');
Expand All @@ -112,7 +112,7 @@ var CreateRenderer = function (game)
}
}

if (typeof WEBGL_RENDERER && !typeof CANVAS_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined' && !typeof CANVAS_RENDERER !== 'undefined')
{
WebGLRenderer = require('../renderer/webgl/WebGLRenderer');

Expand All @@ -122,7 +122,7 @@ var CreateRenderer = function (game)
game.renderer = new WebGLRenderer(game);
}

if (!typeof WEBGL_RENDERER && typeof CANVAS_RENDERER)
if (!typeof WEBGL_RENDERER !== 'undefined' && typeof CANVAS_RENDERER !== 'undefined')
{
CanvasRenderer = require('../renderer/canvas/CanvasRenderer');

Expand Down
2 changes: 1 addition & 1 deletion src/core/DebugHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ var DebugHeader = function (game)
}
}

var fb = (typeof PLUGIN_FBINSTANT) ? '-FB' : '';
var fb = (typeof PLUGIN_FBINSTANT !== 'undefined') ? '-FB' : '';

if (!config.hidePhaser)
{
Expand Down
10 changes: 5 additions & 5 deletions src/core/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ var TextureManager = require('../textures/TextureManager');
var TimeStep = require('./TimeStep');
var VisibilityHandler = require('./VisibilityHandler');

if (typeof FEATURE_SOUND)
if (typeof FEATURE_SOUND !== 'undefined')
{
var SoundManagerCreator = require('../sound/SoundManagerCreator');
}

if (typeof PLUGIN_FBINSTANT)
if (typeof PLUGIN_FBINSTANT !== 'undefined')
{
var FacebookInstantGamesPlugin = require('../../plugins/fbinstant/src/FacebookInstantGamesPlugin');
}
Expand Down Expand Up @@ -255,7 +255,7 @@ var Game = new Class({
*/
this.sound = null;

if (typeof FEATURE_SOUND)
if (typeof FEATURE_SOUND !== 'undefined')
{
this.sound = SoundManagerCreator.create(this);
}
Expand Down Expand Up @@ -284,7 +284,7 @@ var Game = new Class({
*/
this.plugins = new PluginManager(this, this.config);

if (typeof PLUGIN_FBINSTANT)
if (typeof PLUGIN_FBINSTANT !== 'undefined')
{
/**
* An instance of the Facebook Instant Games Plugin.
Expand Down Expand Up @@ -395,7 +395,7 @@ var Game = new Class({

this.events.emit(Events.BOOT);

if (typeof WEBGL_DEBUG && window)
if (typeof WEBGL_DEBUG !== 'undefined' && window)
{
window.PHASER_GAME = this;
}
Expand Down
4 changes: 2 additions & 2 deletions src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ var NOOP = require('../../../utils/NOOP');
var renderWebGL = NOOP;
var renderCanvas = NOOP;

if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
renderWebGL = require('./DynamicBitmapTextWebGLRenderer');
}

if (typeof CANVAS_RENDERER)
if (typeof CANVAS_RENDERER !== 'undefined')
{
renderCanvas = require('./DynamicBitmapTextCanvasRenderer');
}
Expand Down
4 changes: 2 additions & 2 deletions src/gameobjects/bitmaptext/static/BitmapTextRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ var NOOP = require('../../../utils/NOOP');
var renderWebGL = NOOP;
var renderCanvas = NOOP;

if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
renderWebGL = require('./BitmapTextWebGLRenderer');
}

if (typeof CANVAS_RENDERER)
if (typeof CANVAS_RENDERER !== 'undefined')
{
renderCanvas = require('./BitmapTextCanvasRenderer');
}
Expand Down
4 changes: 2 additions & 2 deletions src/gameobjects/blitter/BlitterRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ var NOOP = require('../../utils/NOOP');
var renderWebGL = NOOP;
var renderCanvas = NOOP;

if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
renderWebGL = require('./BlitterWebGLRenderer');
}

if (typeof CANVAS_RENDERER)
if (typeof CANVAS_RENDERER !== 'undefined')
{
renderCanvas = require('./BlitterCanvasRenderer');
}
Expand Down
4 changes: 2 additions & 2 deletions src/gameobjects/container/ContainerRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ var NOOP = require('../../utils/NOOP');
var renderWebGL = NOOP;
var renderCanvas = NOOP;

if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
renderWebGL = require('./ContainerWebGLRenderer');
}

if (typeof CANVAS_RENDERER)
if (typeof CANVAS_RENDERER !== 'undefined')
{
renderCanvas = require('./ContainerCanvasRenderer');
}
Expand Down
4 changes: 2 additions & 2 deletions src/gameobjects/domelement/DOMElementRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ var NOOP = require('../../utils/NOOP');
var renderWebGL = NOOP;
var renderCanvas = NOOP;

if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
renderWebGL = require('./DOMElementCSSRenderer');
}

if (typeof CANVAS_RENDERER)
if (typeof CANVAS_RENDERER !== 'undefined')
{
renderCanvas = require('./DOMElementCSSRenderer');
}
Expand Down
4 changes: 2 additions & 2 deletions src/gameobjects/extern/ExternRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ var NOOP = require('../../utils/NOOP');
var renderWebGL = NOOP;
var renderCanvas = NOOP;

if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
renderWebGL = require('./ExternWebGLRenderer');
}

if (typeof CANVAS_RENDERER)
if (typeof CANVAS_RENDERER !== 'undefined')
{
renderCanvas = require('./ExternCanvasRenderer');
}
Expand Down
4 changes: 2 additions & 2 deletions src/gameobjects/graphics/GraphicsRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ var NOOP = require('../../utils/NOOP');
var renderWebGL = NOOP;
var renderCanvas = NOOP;

if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
renderWebGL = require('./GraphicsWebGLRenderer');

// Needed for Graphics.generateTexture
renderCanvas = require('./GraphicsCanvasRenderer');
}

if (typeof CANVAS_RENDERER)
if (typeof CANVAS_RENDERER !== 'undefined')
{
renderCanvas = require('./GraphicsCanvasRenderer');
}
Expand Down
4 changes: 2 additions & 2 deletions src/gameobjects/image/ImageRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ var NOOP = require('../../utils/NOOP');
var renderWebGL = NOOP;
var renderCanvas = NOOP;

if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
renderWebGL = require('./ImageWebGLRenderer');
}

if (typeof CANVAS_RENDERER)
if (typeof CANVAS_RENDERER !== 'undefined')
{
renderCanvas = require('./ImageCanvasRenderer');
}
Expand Down
2 changes: 1 addition & 1 deletion src/gameobjects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ var GameObjects = {
};

// WebGL only Game Objects
if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
GameObjects.Shader = require('./shader/Shader');
GameObjects.Mesh = require('./mesh/Mesh');
Expand Down
4 changes: 2 additions & 2 deletions src/gameobjects/layer/LayerRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ var NOOP = require('../../utils/NOOP');
var renderWebGL = NOOP;
var renderCanvas = NOOP;

if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
renderWebGL = require('./LayerWebGLRenderer');
}

if (typeof CANVAS_RENDERER)
if (typeof CANVAS_RENDERER !== 'undefined')
{
renderCanvas = require('./LayerCanvasRenderer');
}
Expand Down
2 changes: 1 addition & 1 deletion src/gameobjects/mesh/MeshFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var GameObjectFactory = require('../GameObjectFactory');
*
* @return {Phaser.GameObjects.Mesh} The Game Object that was created.
*/
if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
GameObjectFactory.register('mesh', function (x, y, texture, frame, vertices, uvs, indicies, containsZ, normals, colors, alphas)
{
Expand Down
4 changes: 2 additions & 2 deletions src/gameobjects/mesh/MeshRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ var NOOP = require('../../utils/NOOP');
var renderWebGL = NOOP;
var renderCanvas = NOOP;

if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
renderWebGL = require('./MeshWebGLRenderer');
}

if (typeof CANVAS_RENDERER)
if (typeof CANVAS_RENDERER !== 'undefined')
{
renderCanvas = require('./MeshCanvasRenderer');
}
Expand Down
2 changes: 1 addition & 1 deletion src/gameobjects/nineslice/NineSliceFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ var GameObjectFactory = require('../GameObjectFactory');
*
* @return {Phaser.GameObjects.NineSlice} The Game Object that was created.
*/
if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
GameObjectFactory.register('nineslice', function (x, y, texture, frame, width, height, leftWidth, rightWidth, topHeight, bottomHeight)
{
Expand Down
4 changes: 2 additions & 2 deletions src/gameobjects/nineslice/NineSliceRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ var NOOP = require('../../utils/NOOP');
var renderWebGL = NOOP;
var renderCanvas = NOOP;

if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
renderWebGL = require('./NineSliceWebGLRenderer');
}

if (typeof CANVAS_RENDERER)
if (typeof CANVAS_RENDERER !== 'undefined')
{
// renderCanvas = require('./MeshCanvasRenderer');
}
Expand Down
4 changes: 2 additions & 2 deletions src/gameobjects/particles/ParticleEmitterRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ var NOOP = require('../../utils/NOOP');
var renderWebGL = NOOP;
var renderCanvas = NOOP;

if (typeof WEBGL_RENDERER)
if (typeof WEBGL_RENDERER !== 'undefined')
{
renderWebGL = require('./ParticleEmitterWebGLRenderer');
}

if (typeof CANVAS_RENDERER)
if (typeof CANVAS_RENDERER !== 'undefined')
{
renderCanvas = require('./ParticleEmitterCanvasRenderer');
}
Expand Down

0 comments on commit 7aaa976

Please sign in to comment.