-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.js
95 lines (93 loc) · 3.04 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const webpack = require('webpack');
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
module.exports = (env="production") => {
const production = env === "production";
return {
entry: './client/index.ts',
mode: 'development',
module: {
rules: [
{
test: /\.tsx?$/,
use: [
'babel-loader',
'ts-loader',
],
exclude: /node_modules/
},
{
test: /\.s?[ac]ss$/i,
use: [
// Creates `style` nodes from JS strings
'style-loader',
// Translates CSS into CommonJS
{
loader: 'css-loader',
options: {
modules: false,
},
},
// compatibility and stuff
{
loader: 'postcss-loader', // Run post css actions
options: {
plugins: function () { // post css plugins, can be exported to postcss.config.js
return [
require('precss'),
require('autoprefixer')
];
}
}
},
// Compiles Sass to CSS
'sass-loader',
],
},
{
test: /\.md$/,
use: [
{
loader: "html-loader"
},
{
loader: "markdown-loader",
options: {
/* your options here */
}
}
]
},
],
},
devtool: production ? "source-map" : 'inline-source-map',
optimization: {
minimize: production,
minimizer: [new TerserPlugin()],
},
resolve: {
extensions: [ '.tsx', '.ts', '.js', '.scss', '.css' ]
},
output: {
filename: 'uwp.js',
path: path.resolve(__dirname, `build/${env}`),
publicPath: 'js',
libraryTarget: 'umd',
library: 'uwp',
},
devServer: {
hot: false,
inline: false,
contentBase: 'static/',
historyApiFallback: true,
port: 9000,
},
plugins: [
new webpack.EnvironmentPlugin([
'SIGNALING_URI',
'STUN_URI',
'TURN_CONFIG',
]),
],
}
}