-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
63 lines (59 loc) · 1.75 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
54
55
56
57
58
59
60
61
62
63
/* Load required modules: path and html-webpack-plugin */
let path = require('path');
let HtmlWebpackPlugin = require('html-webpack-plugin');
let ROOT_PATH = path.resolve(__dirname);
let ENTRY_PATH = path.resolve(ROOT_PATH, 'app/js/index.js');
// let SRC_PATH = path.resolve(ROOT_PATH, 'app');
let JS_PATH = path.resolve(ROOT_PATH, 'app/js');
let TEMPLATE_PATH = path.resolve(ROOT_PATH, 'app/index.html');
// let SHADER_PATH = path.resolve(ROOT_PATH, 'src/shaders');
let BUILD_PATH = path.resolve(ROOT_PATH, 'dist');
// set debug to true if we are not in production environment
let debug = process.env.NODE_ENV !== 'production';
module.exports = {
entry: ENTRY_PATH,
output: {
path: BUILD_PATH,
filename: 'bundle.js'
},
plugins: [
/*
HTML webpack plugin generates <script> and <link> tags
and merges them into our starter template HTML
*/
new HtmlWebpackPlugin({
title: 'WebGL Three.js Starter', // Goes under <title> of the generated HTML
template: TEMPLATE_PATH, // Template HTML to use
inject: 'body' // Inject the <script> tags in <body>
})
],
module: {
rules: [
{
test: /\.js$/,
// include: JS_PATH,
exclude: /(node_module|bower_components)/,
loader: 'babel-loader',
// query: {
// cacheDirectory: true
// }
options: {
presets: [
'@babel/preset-env',
{
plugins: [
'@babel/plugin-proposal-class-properties'
]
}
]
},
},
// {
// test: /\.glsl$/,
// include: SHADER_PATH,
// loader: 'webpack-glsl-loader'
// }
]
},
//devtool: 'source-map'
};