-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Expand file tree
/
Copy pathwebpack.config.js
More file actions
75 lines (63 loc) · 2.05 KB
/
Copy pathwebpack.config.js
File metadata and controls
75 lines (63 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
'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',
resolve: {
extensions: ['.js', '.ts'],
extensionAlias: {
'.js': ['.ts', '.js']
}
},
module: {
rules: [
{
test: /\.ts$/,
loader: 'esbuild-loader',
options: {
target: 'es2018'
}
}
]
},
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(true),
"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'
}
];