This repository has been archived by the owner on Jun 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.common.js
70 lines (68 loc) · 1.6 KB
/
webpack.common.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
require('coffeescript/register');
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const GitRevisionPlugin = require('git-revision-webpack-plugin');
const gitRevision = new GitRevisionPlugin();
module.exports = debug => ({
entry: './ts/index.ts',
module: {
rules: [
{
test: /\.wasm$/,
use: 'wasm-loader',
exclude: /node_modules/
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.glsl$/,
use: {
loader: 'pieglsl-loader',
options: {
debug,
}
},
exclude: /node_modules/
},
{
test: /\.less$/,
use: ExtractTextPlugin.extract({
use: [{
loader: 'css-loader',
options: {
modules: true,
},
}, {
loader: 'less-loader',
}],
}),
},
]
},
resolve: {
extensions: [ '.tsx', '.ts', '.js', '.glsl', '.less' ]
},
resolveLoader: {
alias: {
'pieglsl-loader': path.resolve(__dirname, 'tools/pieglsl-loader.coffee'),
},
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
plugins: [
new ExtractTextPlugin('bundle.css'),
new webpack.DefinePlugin({
'process.env': {
'VERSION': JSON.stringify(gitRevision.version()),
'COMMITHASH': JSON.stringify(gitRevision.commithash()),
'BRANCH': JSON.stringify(gitRevision.branch()),
},
}),
],
});