forked from soma-tripleb/moneydog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
101 lines (95 loc) · 2.14 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
const path = require('path');
const Dotenv = require('dotenv-webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const outputDir = 'dist';
module.exports = {
mode: 'development',
node: {fs: 'empty'},
devtool: 'eval',
resolve: {
extensions: ['.js', '.jsx'],
alias: {
root: path.resolve(__dirname, 'client/src/root/'),
image: path.resolve(__dirname, 'public/static/image'),
},
modules: [
path.join(__dirname, 'client'),
'node_modules'
]
},
devServer: {
historyApiFallback: true,
inline: true,
port: 8080,
},
entry: './client/src/index.jsx',
output: {
path: path.join(__dirname, outputDir),
filename: 'app.jsx',
publicPath: '/'
},
plugins: [
new Dotenv(),
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
template: './public/index.html'
})
],
module: {
rules: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
options: {
presets: [
['@babel/preset-env', {
targets: {
browsers: ['> 5% in KR', 'last 2 chrome versions'],
},
debug: true,
}],
'@babel/preset-react',
],
plugins: [
'@babel/plugin-proposal-class-properties',
'react-hot-loader/babel',
['import', { 'libraryName': 'antd', 'style': true }],
],
},
},
{
test: [/\.css?$/],
use: [
'style-loader', 'css-loader',
],
},
{
test: [/\.less?$/],
use: [
'style-loader', 'css-loader',
{
loader: 'less-loader',
options: {
javascriptEnabled: true,
},
},
],
},
{
test: [/\.(png|jpg|jpeg)?$/],
use: [
'file-loader',
],
},
{
test: [/\.(ico|gif|svg|woff|woff2|ttf|eot)?$/],
loader: 'url-loader',
options: {
name: '[hash].[ext]',
limit: 10000,
},
},
],
},
};