-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.ts
66 lines (62 loc) · 1.68 KB
/
webpack.config.ts
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
import * as path from 'path';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import { ProvidePlugin, Configuration as WebpackConfiguration } from 'webpack';
import { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';
interface Configuration extends WebpackConfiguration {
devServer?: WebpackDevServerConfiguration;
}
const config: Configuration = {
mode: 'development',
entry: path.resolve(__dirname, 'src', 'renderer', 'index.tsx'),
devtool: 'inline-source-map',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
clean: true,
},
module: {
rules: [
{
test: /\.[t]sx?$/,
include: path.resolve(__dirname, 'src', 'renderer'),
use: [{ loader: 'babel-loader' }],
},
{
test: /\.css$/,
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
},
{
test: /\.s[ac]ss$/i,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{ loader: 'sass-loader' },
],
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
alias: {
'@': path.resolve(__dirname, 'src', 'renderer'),
},
},
plugins: [
new ForkTsCheckerWebpackPlugin(),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src', 'renderer', 'index.html'),
}),
new ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
],
devServer: {
static: {
directory: path.resolve(__dirname, 'dist'),
},
hot: true,
},
};
// eslint-disable-next-line import/no-default-export
export default config;