-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.webpackrc.js
77 lines (73 loc) · 1.73 KB
/
.webpackrc.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
import defaultWebpackConfig from 'scaffold-core/dist/webpackConfig';
const path = require('path');
const ENV_PATH = process.env.ENV_PUBLIC_PATH;
const proxyObj = {
proxyName: {
target: 'http://objectivezt',
changeOrigin: true,
pathRewrite: {
'^/': ''
}
}
};
const { custom, createAlias } = defaultWebpackConfig;
const proxyUrl = proxyObj.proxyName;
const config = {
alias: {
mock: path.resolve(__dirname, 'mock/'),
globalUI: path.resolve(__dirname, 'src/common/globalUI/'),
...createAlias(__dirname),
'@setting': path.resolve(__dirname, 'src/setting/')
},
...custom,
copy: [
{
from: path.resolve(__dirname, 'src/containers/Module/d3root/'),
to: 'iframe/'
},
{
from: path.resolve(__dirname, 'src/assets/favicon.ico'),
to: '/'
}
],
entry: 'src/index.js',
// extraBabelPresets: [['@babel/preset-typescript']],
extraBabelPlugins: [
[
'import',
{
libraryName: 'antd',
libraryDirectory: 'es',
style: true
}
],
'@babel/plugin-transform-typescript',
'@babel/proposal-class-properties',
'@babel/proposal-object-rest-spread'
],
env: {
development: {
extraBabelPlugins: ['dva-hmr']
}
},
define: {
'process.env.NODE_ENV': process.env.NODE_ENV,
'process.env.ENV_API_CONTEXT': process.env.ENV_API_CONTEXT,
'process.env.ENV_PUBLIC_PATH': process.env.ENV_PUBLIC_PATH
},
html: {
template: './src/index.ejs'
},
outputPath: './dist',
publicPath: '/',
theme: './src/common/theme.js',
proxy: {
'/test': proxyUrl,
'/api': {
target: 'https://cnodejs.org/api/v1',
changeOrigin: true,
pathRewrite: { '^/api': '' }
}
}
};
export default config;