-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
78 lines (72 loc) · 1.87 KB
/
webpack.config.js
File metadata and controls
78 lines (72 loc) · 1.87 KB
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
76
77
78
var fs = require('fs');
var path = require('path');
const webpack = require('webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
var execSync = require('child_process').execSync;
var execOpts = { encoding: 'utf8' };
var gitRev = execSync('git rev-parse HEAD', execOpts);
var gitDate = execSync('git show -s --format=%ci HEAD', execOpts);
fs.writeFileSync(path.resolve(__dirname, 'src', 'version.js'),
'export const gitRev = "' + gitRev.trim() + '";\n' +
'export const gitDate = "' + gitDate.trim() + '";\n');
module.exports = {
entry: ['@babel/polyfill', './src/ui/main.js'],
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: 'Gavrog for the Web',
favicon: path.resolve(__dirname, '3dt.ico'),
meta: {
viewport: "initial-scale=1.0,width=device-width",
["apple-mobile-web-app-capable"]: "yes"
}
}),
new webpack.HashedModuleIdsPlugin()
],
output: {
filename: '[name].[contenthash].js',
path: path.resolve(__dirname, 'dist')
},
optimization: {
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
}
}
}
},
module: {
rules: [
{ test: /\.js$/,
exclude: /node_modules/,
use: "babel-loader"
},
{ test: /\.elm$/,
exclude: [/node_modules/, /elm-stuff/],
use: {
loader: "elm-webpack-loader",
options: {
debug: false
}
}
},
{
test: /sceneWorker\.js$/,
use: {
loader: 'worker-loader',
options: {
inline: true
}
}
}
]
},
resolve: {
extensions: [ ".js", ".elm" ]
}
}