forked from AktivCo/Rutoken-VPN-Community-Edition-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.babel.js
90 lines (84 loc) · 2.98 KB
/
webpack.config.babel.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
import path from 'path';
import { AngularCompilerPlugin } from '@ngtools/webpack';
import { DefinePlugin } from 'webpack';
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const join = (...args) => path.join(__dirname, ...args);
module.exports = env => {
const entryResources = [];
if (JSON.stringify(env.opensource) === "true") {
entryResources.push('./front/styles/variables.opensource.css');
}
entryResources.push(
'./front/styles/layout.css',
'./front/styles/styles.css',
'./front/styles/vpn_styles.css',
'./front/styles/login.css',
'./front/app.ts',
);
return {
entry: entryResources,
output:
{
path: join('./vpnserver/static'),
filename: "app.bundle.js"
},
module:
{
rules:
[
{
test: /\.ts$/,
use: [
{
loader: 'awesome-typescript-loader',
options: { configFileName: join('./front', 'tsconfig.json') }
},
'angular2-template-loader'
]
},
{
test: /\.html$/,
loader: 'html-loader'
},
{
test: /\.(png|jpg|gif|svg)$/,
use: {
loader: 'url-loader',
options: {
limit: 25000
}
},
},
{
test: /\.css$/,
use: [
'style-loader',
MiniCssExtractPlugin.loader,
'css-loader'
]
}
]
},
resolve: {
extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js']
},
plugins: [
new DefinePlugin({
OPENSOURCE: JSON.stringify(env.opensource) === "true",
}),
new MiniCssExtractPlugin({ filename: 'styles.css' }),
new AngularCompilerPlugin({
mainPath: join('./front', 'app.ts'),
platform: 0,
sourceMap: true,
tsConfigPath: join('./front', 'tsconfig.json'),
skipCodeGeneration: true,
compilerOptions: {},
})
],
watch: false,
watchOptions: {
poll: false //for watch option on linux
}
}
};