-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
83 lines (82 loc) · 2.52 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
const HtmlWebPackPlugin = require("html-webpack-plugin");
const path = require('path');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
devtool: 'source-map',
devServer: {
disableHostCheck: true,
historyApiFallback: true,
},
entry: ["@babel/polyfill", './src/index'],
output: {
filename: '[hash].bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
use: ['babel-loader', 'eslint-loader'],
},
{
test: /\.(ts|tsx)$/,
use: ['ts-loader'],
},
{
test: /\.html$/,
use: [
{
loader: "html-loader",
options: {minimize: true}
}
]
},
{
test: /\.(eot|ttf|woff|woff2|png|jpg|gif)$/,
use: {
loader: "file-loader",
}
},
{
test: /\.svg$/,
use: ['@svgr/webpack'],
},
{
test: /\.(css|scss)$/,
/*exclude: /node_modules/,*/
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.json$/,
loader: 'raw-loader'
}
]
},
plugins: [
new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html",
inject: 'body',
favicon: "./src/common/favicon.svg",
}),
new CopyPlugin([
{from: 'src/config/*.json', toType: 'dir'},
]),
new CleanWebpackPlugin(),
],
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
alias: {
components: path.resolve(__dirname, 'src/components/'),
modules: path.resolve(__dirname, 'src/modules/'),
containers: path.resolve(__dirname, 'src/containers/'),
pages: path.resolve(__dirname, 'src/pages/'),
reducers: path.resolve(__dirname, 'src/reducers/'),
routes: path.resolve(__dirname, 'src/routes/'),
store: path.resolve(__dirname, 'src/store/'),
config: path.resolve(__dirname, 'src/config/'),
actions: path.resolve(__dirname, 'src/actions/'),
utils: path.resolve(__dirname, 'src/utils/'),
}
},
};