-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
53 lines (52 loc) · 1.42 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
/* eslint @typescript-eslint/no-var-requires: "off" */
const path = require('path')
const HTMLWebpackPlugin = require('html-webpack-plugin')
const webpack = require('webpack')
module.exports = {
devServer: {
historyApiFallback: true,
port: 3000,
},
devtool: 'source-map',
entry: './src/index.tsx',
mode: process.env.MODE,
module: {
rules: [
{
exclude: /node_modules/,
test: /\.ts(x?)$/,
use: ['babel-loader'],
},
],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
sourceMapFilename: '[name].js.map',
},
plugins: [
new webpack.SourceMapDevToolPlugin({
filename: '[file].map[query]',
}),
new webpack.EnvironmentPlugin({
MODE: process.env.MODE,
}),
new HTMLWebpackPlugin({
template: 'public/index.html',
}),
],
resolve: {
alias: {
'#components': path.resolve(process.cwd(), 'src/components'),
'#constants': path.resolve(process.cwd(), 'src/constants'),
'#providers': path.resolve(process.cwd(), 'src/providers'),
'#store': path.resolve(process.cwd(), 'src/store'),
'#styles': path.resolve(process.cwd(), 'src/styles'),
'#utils': path.resolve(process.cwd(), 'src/utils'),
'#view': path.resolve(process.cwd(), 'src/view'),
'#src': path.resolve(process.cwd(), 'src'),
},
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
}