-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
100 lines (98 loc) · 2.77 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
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
/*jshint esversion: 8*/
const path = require('path');
//const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
//var AppCachePlugin = require('appcache-webpack-plugin');
//const CompressionPlugin = require('compression-webpack-plugin');
//var HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
module.exports = {
mode: 'production',
entry: {
//'SuperQuest.full': path.join(__dirname, 'index'),
'Physics-Lite': path.join(__dirname, 'src/physics-lite/index'),
//'SuperQuest.slim': path.join(__dirname, 'slim'),
'SuperQuest': path.join(__dirname, 'index'),
'google-poly-component': path.resolve(__dirname, 'src','extras-collection','google-poly'),
},
output: {
path: __dirname + '/dist',
filename: '[name].min.js',
//chunkFilename: 'js/vendor/[name].js'
},
module: {
rules: [
{
test: /.jsx?$/,
include: [
path.resolve(__dirname, 'src')
],
exclude: [
path.resolve(__dirname, 'node_modules'), /\.worker\.js$/
],
use: [{
loader: 'babel-loader',
options: {
presets: [
['@babel/env', {
'targets': {
'browsers': 'last 2 chrome versions'
}
}]
]
}
}]
},
{
test: /\.worker\.js$/,
use: [{
loader: 'worker-loader',
options: {
worker: 'PhysicsWorker',
inline: 'fallback',
//fallback: true,
filename: '[name].min.js'
}
}],
},
{
test: /\.glb$/,
use: {
loader: 'file-loader',
options: {
name: '[name].glb'
}
},
},
]
},
plugins: [
],
resolve: {
extensions: ['.json', '.js', '.jsx']
},
optimization: {
minimizer: [
new TerserPlugin({
extractComments: 'all',
terserOptions: {
drop_console: false,
ecma: undefined,
warnings: false,
parse: {},
compress: {},
mangle: true,
module: true,
output: null,
toplevel: false,
nameCache: null,
ie8: false,
keep_classnames: undefined,
keep_fnames: false,
safari10: false,
},
test: /\.js(\?.*)?$/i,
}),
],
}
};