-
Notifications
You must be signed in to change notification settings - Fork 24
/
webpack.config.js
75 lines (67 loc) · 2.12 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
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
// Setup global, additional definitions for the build/configuration.
var DEFINITIONS = {
DISABLE_ASSERTIONS: JSON.stringify(false),
LOG_VERBOSITY_THRESHOLD: JSON.stringify(3),
};
// If configured from within a git repository, add revision information to DEFINITIONS.
if (fs.existsSync('.git')) {
const GitRevisionPlugin = require('git-revision-webpack-plugin')
const gitrev = new GitRevisionPlugin();
DEFINITIONS.GIT_REV_VERSION = JSON.stringify(gitrev.version());
DEFINITIONS.GIT_REV_COMMIT = JSON.stringify(gitrev.commithash());
DEFINITIONS.GIT_REV_BRANCH = JSON.stringify(gitrev.branch());
}
const rxjsExternals = require('webpack-rxjs-externals');
module.exports = {
context: __dirname + '/source',
cache: false,
entry: {
'js/webgl-operate.js': ['polyfill.ts', 'webgl-operate.ts'],
},
devtool: 'source-map',
plugins: [
new webpack.DefinePlugin(DEFINITIONS)
],
output: {
path: __dirname + '/build',
filename: '[name]',
library: 'gloperate',
libraryTarget: 'umd'
},
externals: [
rxjsExternals()
],
resolve: {
modules: [__dirname + '/node_modules', __dirname + '/source'],
extensions: ['.ts', '.tsx', '.js'],
fallback: { "url": require.resolve("url/") }
},
watchOptions: {
ignored: ['node_modules/**']
},
module: {
rules: [
{
test: /\.tsx?$/,
include: /source/,
exclude: /(source\/shaders|demos|website|node_modules)/,
use: {
loader: 'ts-loader',
options: {
compilerOptions: {
declaration: false,
noUnusedLocals: false,
removeComments: true
}
}
}
},
{
test: /\.(glsl|vert|frag)$/,
use: { loader: 'webpack-glsl-loader' },
}]
},
};