-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
55 lines (54 loc) · 1.21 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
const childProcess = require("child_process");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const webpack = require("webpack");
module.exports = {
entry: "./src/entry.tsx",
devtool: "source-map",
devServer: {
static: './build',
},
optimization: {
runtimeChunk: 'single',
},
output: {
hashFunction: "xxhash64",
path: __dirname + "/build",
filename: "[name].js",
sourceMapFilename: "[file].map",
},
module: {
rules: [
{
test: /\.(j|t)sx?$/,
exclude: /(node_modules|bower_components)/,
loader: "babel-loader",
},
{
test: /\.css$/,
use: [
"style-loader",
"css-loader"
]
},
],
},
plugins: [
new webpack.DefinePlugin({
__BUILD__: JSON.stringify(
childProcess.execSync("git rev-parse --short HEAD").toString().trim()
),
}),
new HtmlWebpackPlugin({
template: "index.html"
}),
],
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
fallback: {
buffer: require.resolve("buffer/"),
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
}
}
};