-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathwebpack.common.js
79 lines (76 loc) · 1.77 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
71
72
73
74
75
76
77
78
79
const HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require("path");
const merge = require('webpack-merge');
const config = {
output: {
publicPath: "/",
path: path.resolve(__dirname, "public"),
filename: "[name].js",
chunkFilename: '[name].bundle.js',
},
optimization: {
splitChunks: {
chunks: "all"
}
},
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/
},
// don't handle scss here; do it in prod/dev since they're done differently
// {
// test: /\.scss$/,
// use: [
// // MiniCssExtractPlugin.loader,
// "style-loader",
// 'css-loader',
// 'sass-loader'
// ]
// },
{
test: /\.(vert|frag|glsl)$/,
use: "webpack-glsl-loader"
}
]
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
alias: {
'three-examples': path.resolve(__dirname, 'node_modules/three/examples/js/')
}
},
};
const isKiosk = !!process.env.KIOSK;
if (isKiosk) {
module.exports = merge(config, {
entry: {
kiosk: "./openpose_kiosk/src/index.tsx",
},
plugins: [
new HtmlWebpackPlugin({
filename: 'kiosk.html',
inlineSource: ".css$",
template: 'src/index.template.html',
}),
new HtmlWebpackInlineSourcePlugin(),
]
});
} else {
module.exports = merge(config, {
entry: {
main: "./src/index.tsx",
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
inlineSource: ".css$",
template: 'src/index.template.html',
}),
new HtmlWebpackInlineSourcePlugin(),
]
});
}