-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwebpack.dev.config.js
executable file
·89 lines (86 loc) · 1.84 KB
/
webpack.dev.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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ESLintPlugin = require('eslint-webpack-plugin');
const phaserModule = path.join(__dirname, '/node_modules/phaser-ce/');
const phaser = path.join(phaserModule, 'build/custom/phaser-arcade-physics.js');
const pixi = path.join(phaserModule, 'build/custom/pixi.js');
const p2 = path.join(phaserModule, 'build/custom/p2.js');
module.exports = {
devServer: {
static: {
directory: path.resolve(__dirname, 'assets'),
publicPath: '/assets',
},
hot: true,
open: true,
compress: true,
port: 8000,
},
entry: {
app: [
path.resolve(pixi),
path.resolve(p2),
path.resolve(__dirname, 'src/app.ts'),
]
},
output: {
filename: '[name].bundle.js',
path: path.resolve('./dist'),
publicPath: '/'
},
plugins: [
new ESLintPlugin({
files: ['./src/**/*.ts']
}),
new HtmlWebpackPlugin({
template: './index.html',
inject: 'body'
})
],
module: {
rules: [
{
test: /\.(j|t)s$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader'
}
},
{
test: /pixi\.js/,
use: {
loader: 'expose-loader',
options: {
exposes: ['PIXI', pixi]
}
}
},
{
test: /p2\.js$/,
use: {
loader: 'expose-loader',
options: {
exposes: ['p2', p2]
}
}
},
{
test: /phaser-arcade-physics\.js/,
use: {
loader: 'expose-loader',
options: {
exposes: ['Phaser', phaser]
}
}
},
]
},
resolve: {
extensions: ['.js', '.ts'],
alias: {
'phaser-ce': phaser,
'pixi': pixi,
'p2': p2,
}
}
};