-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.game-01.config.js
46 lines (37 loc) · 1.12 KB
/
webpack.game-01.config.js
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
const chalk = require('chalk');
const path = require('path');
const webpackBase = require('webpack');
const { webpack } = require('xes-webpack-core');
/**
* Copy assets and fonts.
*/
// const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = (config) => {
console.log(chalk.bold.yellow('Setting WEBPACK for game-01...'));
config.module.rules.push(...webpack.loaders.shaderRulesFactory());
console.log(chalk.bold.yellow('Adding Phaser 3 environment setup...'));
config.plugins.push(new webpackBase.DefinePlugin({
// required by Phaser 3
'CANVAS_RENDERER': JSON.stringify(true),
'WEBGL_RENDERER': JSON.stringify(true),
}));
/*config.externals = {
...config.externals,
moment: 'moment',
};*/
// config.devServer.disableHostCheck = true;
// config.devtool = 'cheap-module-source-map';
// all externals need to be manually added in template
// TODO: add them automatically
/*config.externals = {
...config.externals,
phaser: 'Phaser',
};
config.plugins.push(new CopyWebpackPlugin([
{
from: './node_modules/phaser/dist/phaser.min.js',
to: 'phaser.min.js',
},
]));*/
return config;
};