phaser/webpack.config.js

50 lines
1.4 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
2016-11-22 03:32:41 +00:00
module.exports = {
2018-03-20 12:24:42 +00:00
mode: 'development',
2016-11-22 16:25:54 +00:00
context: `${__dirname}/src/`,
2016-11-22 16:25:54 +00:00
2018-04-13 16:05:45 +00:00
entry: {
2018-09-20 13:14:44 +00:00
phaser: './phaser.js'
2018-04-13 16:05:45 +00:00
},
2016-11-22 16:25:54 +00:00
2016-11-22 03:32:41 +00:00
output: {
path: `${__dirname}/build/`,
2016-11-22 16:25:54 +00:00
filename: '[name].js',
library: 'Phaser',
libraryTarget: 'umd',
sourceMapFilename: '[file].map',
2018-03-20 12:24:42 +00:00
devtoolModuleFilenameTemplate: 'webpack:///[resource-path]', // string
devtoolFallbackModuleFilenameTemplate: 'webpack:///[resource-path]?[hash]', // string
umdNamedDefine: true
2016-11-22 16:25:54 +00:00
},
2018-05-08 22:29:42 +00:00
performance: { hints: false },
plugins: [
new webpack.DefinePlugin({
"typeof CANVAS_RENDERER": JSON.stringify(true),
"typeof WEBGL_RENDERER": JSON.stringify(true),
"typeof EXPERIMENTAL": JSON.stringify(false),
"typeof PLUGIN_CAMERA3D": JSON.stringify(false),
"typeof PLUGIN_FBINSTANT": JSON.stringify(false)
}),
{
apply: (compiler) => {
compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => {
exec('node scripts/copy-to-examples.js', (err, stdout, stderr) => {
if (stdout) process.stdout.write(stdout);
if (stderr) process.stderr.write(stderr);
});
});
}
}
],
2018-02-13 03:23:29 +00:00
devtool: 'source-map'
2016-11-22 03:32:41 +00:00
};