forked from destinygg/chat-gui
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
97 lines (95 loc) · 3.03 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
96
97
require('dotenv').config();
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
devServer: {
contentBase: path.join(__dirname, 'static'),
compress: true,
port: 8282
},
entry: {
chat: [
'core-js/es6',
'jquery',
'moment',
'normalize.css',
'font-awesome/scss/font-awesome.scss',
'./assets/chat/js/notification',
'./assets/chat/img/favicon.png',
'./assets/chat/css/style.scss',
'./assets/chat.js'
],
streamchat: [
'core-js/es6',
'jquery',
'moment',
'normalize.css',
'font-awesome/scss/font-awesome.scss',
'./assets/chat/js/notification',
'./assets/chat/img/favicon.png',
'./assets/chat/css/style.scss',
'./assets/chat/css/onstream.scss',
'./assets/streamchat.js'
]
},
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
output: {
path: path.resolve(__dirname, 'static'),
filename: '[name].js'
},
plugins: [
new CleanWebpackPlugin(['static'], { root: __dirname, verbose: false, exclude: ['cache', 'index.htm'] }),
new MiniCssExtractPlugin({ filename: '[name].css' }),
new webpack.DefinePlugin({
WEBSOCKET_URI: process.env.WEBSOCKET_URI ? `'${process.env.WEBSOCKET_URI}'` : '"wss://www.destiny.gg/ws"',
API_URI: process.env.API_URI ? `'${process.env.API_URI}'` : '',
LOGIN_URI: process.env.LOGIN_URI ? `'${process.env.LOGIN_URI}'` : 'false'
})
],
watchOptions: {
ignored: /node_modules/
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
loader: 'ts-loader'
},
{
test: /\.js$/,
exclude: /(node_modules\/(?!(timestring)\/).*)/,
loader: 'babel-loader',
options: { presets: ['es2015'] }
},
{
test: /\.(scss|css)$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader',
'sass-loader'
]
},
{
test: /(-webfont|glyphicons-halflings-regular)\.(eot|svg|ttf|woff2?)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader',
options: { name: 'fonts/[name].[ext]' }
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: { name: 'img/[name].[ext]' }
}
]
},
resolve: {
alias: {
jquery: 'jquery/src/jquery'
},
extensions: ['.ts', '.tsx', '.js']
},
context: __dirname,
devtool: false
};