-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.js
108 lines (106 loc) · 3.82 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
98
99
100
101
102
103
104
105
106
107
108
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
const ESLintPlugin = require('eslint-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const WorkerPlugin = require('worker-plugin');
const { InjectManifest } = require('workbox-webpack-plugin');
const WebpackPwaManifest = require('webpack-pwa-manifest');
const TITLE = 'PAA Converter - Gruppe Adler';
const DESCRIPTION = 'Online converter for Arma 3\'s PAA format. Can be used to convert a single or multiple files in bulk and supports paa to png, png to paa, jpg to paa and more.';
module.exports = () => {
return {
entry: './src/index.ts',
mode: 'production',
target: 'es6',
plugins: [
new ESLintPlugin({ extensions: ['ts', 'js', 'tsx', 'jsx'] }),
new MiniCssExtractPlugin({
filename: '[name].[contenthash:8].css',
chunkFilename: '[id].[contenthash:8].css'
}),
new HtmlWebpackPlugin({
template: './src/index.html',
filename: 'index.html',
title: TITLE,
description: DESCRIPTION
}),
new WebpackPwaManifest({
name: TITLE,
short_name: 'GRAD PAA',
description: DESCRIPTION,
theme_color: '#000000',
display: 'standalone',
start_url: '.',
background_color: '#000000',
ios: true,
filename: 'manifest.[hash:8].webmanifest',
icons: [
{
src: path.resolve('src/assets/img/icons/android-chrome.png'),
destination: path.join('assets'),
sizes: [192, 512]
},
{
src: path.resolve('src/assets/img/icons/android-chrome-maskable.png'),
destination: path.join('assets'),
sizes: [192, 512],
purpose: 'maskable'
}
]
}),
new CopyWebpackPlugin({ patterns: [
{ from: 'public', to: '' }
] }),
new WorkerPlugin(),
new InjectManifest({
swSrc: './src/service-worker.ts',
exclude: [
/\.map$/
]
})
],
module: {
rules: [
{
test: /\.tsx?$/i,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.(scss|css)$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
exclude: /node_modules/
},
{
test: /\.(png|svg|jpg|jpeg|gif|ico|woff2|wasm)$/i,
type: 'asset/resource'
}
]
},
devServer: {
port: 3000,
static: path.join(__dirname, 'dist'),
host: '0.0.0.0'
},
resolve: {
fallback: {
stream: false,
util: false,
buffer: false
},
extensions: ['.tsx', '.ts', '.js', '.scss'],
alias: {
'@': path.resolve(__dirname, 'src/')
}
},
output: {
chunkFormat: 'commonjs',
filename: '[name].[contenthash:8].js',
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'umd',
assetModuleFilename: 'assets/[name].[contenthash:8][ext][query]'
}
};
};