-
Notifications
You must be signed in to change notification settings - Fork 1k
/
webpack.config.js
52 lines (48 loc) · 1.19 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
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 = {
mode: 'production',
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(),
],
devServer: {
// contentBase: './dist',
// publicPath: '',
static: {
directory: path.join(__dirname, ''),
},
compress: true,
// port: 9000
}
}