forked from mozilla/BrowserQuest
-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.config.js
53 lines (48 loc) · 1.55 KB
/
webpack.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
const {CheckerPlugin} = require('awesome-typescript-loader');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = env => {
const environment = env.NODE_ENV;
console.log('Project is running with environment: ', environment);
return {
entry: './client/ts/main.ts',
output: {
path: __dirname + '/dist/client',
filename: 'main.js'
},
// Currently we need to add '.ts' to the resolve.extensions array.
resolve: {
extensions: ['.ts', '.js']
},
// Source maps support ('inline-source-map' also works)
devtool: 'source-map',
// Add the loader for .ts files.
module: {
loaders: [
{
test: /\.ts?$/,
loader: 'awesome-typescript-loader?{configFileName: "client/tsconfig.json"}'
}
]
},
plugins: [
new CheckerPlugin(),
new HtmlWebpackPlugin({
title: 'Fate of the Four',
template: './client/index.html'
}),
new CopyWebpackPlugin([
// {output}/file.txt
{from: 'client/img/', to: 'img/'},
{from: 'client/audio/', to: 'audio/'},
{from: 'client/css/', to: 'css/'},
{from: 'client/fonts/', to: 'fonts/'},
{from: 'client/maps/', to: 'maps/'},
{from: 'client/sprites/', to: 'sprites/'},
{from: 'client/ts/map/mapworker.js', to: 'mapworker.js'},
{from: 'client/ts/lib/', to: 'lib/'},
{from: `client/config/config.prod.json`, to: 'client/config/config.json'},
]),
]
}
};