-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
68 lines (63 loc) · 1.69 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
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const prod = (process.env.NODE_ENV = 'production');
module.exports = {
mode: prod ? 'production' : 'development',
entry: './src/index.tsx',
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
module: {
rules: [
{
test: /\.(js|jsx|ts|tsx)$/,
exclude: /node_modules/,
use: ['ts-loader'],
},
{
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: ['@svgr/webpack'],
},
{
test: /\.svg$/i,
issuer: /\.style.js|style.ts$/,
use: ['url-loader'],
},
],
},
output: {
path: path.join(__dirname, '/dist'),
filename: 'bundle.js',
},
devServer: {
historyApiFallback: true,
port: 3000,
hot: true,
static: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: ['.js', '.ts', '.jsx', '.tsx', '.json'],
alias: {
'@': path.resolve(__dirname, './src'),
'@components': path.resolve(__dirname, './src/components'),
'@type': path.resolve(__dirname, './src/types'),
'@hooks': path.resolve(__dirname, './src/hooks'),
'@styles': path.resolve(__dirname, './src/styles'),
'@constants': path.resolve(__dirname, './src/constants'),
'@assets': path.resolve(__dirname, './src/assets'),
'@stories': path.resolve(__dirname, './src/stories'),
'@utils': path.resolve(__dirname, './src/utils'),
},
},
plugins: [
new webpack.ProvidePlugin({
React: 'react',
}),
new HtmlWebpackPlugin({
template: './public/index.html',
}),
new webpack.HotModuleReplacementPlugin(),
],
};