-
Notifications
You must be signed in to change notification settings - Fork 0
/
development.js
84 lines (82 loc) · 1.86 KB
/
development.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
import path from 'path';
const entryPoint = path.resolve(__dirname, 'src');
const distribute = path.resolve(__dirname, 'public');
/*
* ./
* |- src
* | |- client.js //-------- entryPoint.jsx
* | |- client
* | | |- class //---------- webpack targets.js
* | | | |- class.js
* | | | `- class.js
* | | `- components //----- webpack targets.jsx
* | | |- components.jsx
* | | `- components.jsx
* | `- api //--------- webpack ignore
* | |- controller
* | | |- controller1.js
* | | `- controller2.js
* | `- util.js
* |- views
* | `- index.jsx
* `- public
* `- client.bundle.js //--------- distribute.js
*/
module.exports = {
mode: 'development',
entry: {
client: `${entryPoint}/client.js`,
pngWork: `${entryPoint}/pngWork.js`,
jpegWork: `${entryPoint}/jpegWork.js`,
},
output: {
path: distribute,
filename: '[name].bundle.js',
},
module: {
rules: [
{
test: /\.jsx?$/,
use: [{
loader: 'babel-loader',
options: {
presets: [
['env', { 'modules': false }],
'react'
]
}
}],
exclude: /(node_modules|src\/api)/,
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.(woff|woff2)$/,
use: {
loader: 'url-loader',
options: {
name: 'fonts/[hash].[ext]',
limit: 5000,
mimetype: 'application/font-woff'
}
}
},
{
test: /\.(ttf|eot|svg)$/,
use: {
loader: 'file-loader',
options: {
name: 'fonts/[hash].[ext]'
}
}
},
]
},
// devtool: 'source-map',
resolve: {
extensions: ['.js', '.jsx']
},
plugins: []
};