phaser/config/webpack.config.js

61 lines
1.8 KiB
JavaScript
Raw Normal View History

2016-11-22 16:25:54 +00:00
'use strict';
const webpack = require('webpack');
const exec = require('child_process').exec;
2016-11-22 16:25:54 +00:00
module.exports = [
2023-03-22 13:32:05 +00:00
{
mode: 'development',
2016-11-22 16:25:54 +00:00
context: `${__dirname}/../src/`,
2016-11-22 16:25:54 +00:00
entry: {
phaser: './phaser.js'
},
2016-11-22 16:25:54 +00:00
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({
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) => {
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);
});
});
}
}
],
2016-11-22 16:25:54 +00:00
devtool: 'source-map'
}
];