-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack-game-dev.config.js
107 lines (100 loc) · 3.19 KB
/
webpack-game-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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
const path = require('path');
const webpack = require('webpack');
const buildPath = path.resolve(__dirname, '');
const HtmlWebpackPlugin = require('html-webpack-plugin');
process.env.DEBUG = true;
module.exports = {
entry: [
'./index.js'
],
context: path.join(__dirname, 'src'),
devServer: {
contentBase: 'www', // Relative directory for base of server
host: '0.0.0.0', // Change to '0.0.0.0' for external facing server
hot: true, // Live-reload
hotOnly: true,
inline: true,
// noInfo: true,
port: 3011, // Port Number
},
devtool: 'source-map',
output: {
path: buildPath, // Path of output file
filename: 'bundle.js',
},
resolve: {
extensions: ['.js']
},
plugins: [
// Enables Hot Modules Replacement
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new HtmlWebpackPlugin({ title: 'Vector2 Test' }),
// Allows error warnings but does not stop compiling.
// new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
// __DEBUG__: JSON.stringify(JSON.parse(process.env.DEBUG)),
__DEBUG__: JSON.stringify(true)
}),
],
module: {
rules: [
{
test: /\.(less)$/,
use: [
"style-loader",
{
loader: "css-loader",
options: {
modules: true,
localIdentName: '[name]__[local]--[hash:base64:5]' } // BEM-Style
},
{
loader: "less-loader",
options: { relativeUrls: false }
},
],
//exclude: "/\.(png|jpg|svg)?$/"
},
{
test: /\.(css)$/,
use: [
"style-loader", "css-loader"
]
},
{
test: /\.jsx?$/,
loader: 'babel-loader',
options: {
presets: ['env']
},
exclude: /(node_modules|plugins|platforms|hooks|node_server)/
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader?limit=10000&mimetype=application/font-woff"
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: "url-loader?limit=10000&mimetype=application/octet-stream"
},
{
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
loader: "file-loader"
},
{
test: /\.(png|jpg)?$/,
loader: "file-loader"
},
// {
// test: /\.jpg/,
// loader: "file-loader!url-loader?limit=10000&minetype=image/jpg"
// },
{
test: /\.svg(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader?limit=10000&mimetype=image/svg+xml"
// loader: "file-loader"
}
]
}
};