-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
64 lines (61 loc) · 1.64 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const { getAppReleasePaths } = require('./scripts/helpers');
const releasePath = getAppReleasePaths(__dirname)[0].path;
// Constant with our paths
const paths = {
RESOURCES: path.resolve(__dirname, 'resources', 'ui'),
DIST: path.resolve(releasePath, 'resources', 'ui'),
SRC: path.resolve(__dirname, 'src', 'gui', 'html')
};
// Webpack configuration
module.exports = {
mode: 'production',
context: path.join(__dirname),
entry: path.join(paths.SRC, 'js', 'app.ts'),
output: {
path: paths.DIST,
filename: 'app.bundle.js',
publicPath: ''
},
devtool: 'source-map',
plugins: [
new HtmlWebpackPlugin({
template: path.join(paths.SRC, 'index.html')
}),
new CopyWebpackPlugin({
patterns: [
{
from: path.join(paths.SRC, 'css', 'style.css'),
to: path.join(paths.DIST, 'css')
},
{
from: path.join(paths.SRC, 'css', 'typography.css'),
to: path.join(paths.DIST, 'css')
},
{
from: path.join(paths.RESOURCES, 'css', 'dark.theme.css'),
to: path.join(paths.DIST, 'css')
},
{
from: path.join('build', 'fonts'),
to: path.join(paths.DIST, 'fonts')
}
]
})
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader', 'source-map-loader']
},
{ test: /\.tsx?$/, loader: 'ts-loader' }
]
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
};