-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
54 lines (50 loc) · 1.13 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
const path = require('path')
const isDev = process.env.NODE_ENV === 'development'
let HtmlWebpackPlugin
if (isDev) {
HtmlWebpackPlugin = require('html-webpack-plugin')
}
module.exports = {
mode: isDev ? 'development' : 'production',
entry: './index.js',
optimization: {
minimize: !isDev
},
output: {
path: path.resolve('./bundle'),
filename: 'bundle.js',
library: 'ParticleField',
umdNamedDefine: true,
libraryExport: 'default',
libraryTarget: isDev ? 'umd' : 'commonjs2'
},
devtool: 'source-map',
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader?cacheDirectory'
},
{
test: /\.(svg|png|jpg|webm|mp4|woff|woff2)$/,
use: 'file-loader'
},
{
test: /\.(glsl|vs|fs|vert|frag)$/,
exclude: /node_modules/,
use: [
'raw-loader',
'glslify-loader'
]
}]
},
plugins: [
HtmlWebpackPlugin && new HtmlWebpackPlugin({
template: 'index.html'
}),
HtmlWebpackPlugin && new HtmlWebpackPlugin({
filename: 'capture.html',
template: 'capture.html'
})
].filter(Boolean)
}