forked from tengbao/vanta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
42 lines (38 loc) · 1017 Bytes
/
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
const fs = require('fs')
const path = require('path')
const webpack = require('webpack')
// const util = require('util')
const srcFiles = fs.readdirSync('./src')
let entries = {
'gallery/gallery.min': './src/gallery.js',
}
// Compile vanta.xxxxx.js files
for (let i = 0; i < srcFiles.length; i++) {
let file = srcFiles[i]
if (file.indexOf('vanta') == 0) {
let fileWithoutExtension = file.replace(/\.[^/.]+$/, "")
entries['dist/' + fileWithoutExtension + '.min'] = './src/' + file
}
}
module.exports = {
entry: entries,
// watch: true,
output: {
filename: '[name].js',
path: path.resolve(__dirname, '.'),
library: '_vantaEffect',
libraryTarget: 'umd',
globalObject: 'typeof self !== \'undefined\' ? self : this',
},
module: {
rules: [
{ test: /\.(glsl|frag|vert)$/, use: ['raw-loader', 'glslify-loader'], exclude: /node_modules/ },
],
},
optimization: {
minimize: true
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
]
}