-
Notifications
You must be signed in to change notification settings - Fork 1
/
.webpackrc.js
105 lines (101 loc) · 2.81 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
* 管控平台前端框架配置文件
* 代码下载后,修改下面的sys变量完成子系统配置;测试时可修改proxy里的代理地址
* !!!!!!其他配置请勿改动!!!!!!
*/
import { resolve } from 'path';
const fs = require('fs');
const path = require('path');
const lessToJs = require('less-vars-to-js');
/**子系统标识,与src里的子系统文件夹名称保持一致*/
const sys = 'bsp';
const themeVariables1 = lessToJs(
fs.readFileSync(path.join(__dirname, './src/themes/dark/dark.style.less'), 'utf8')
);
const themeVariables2 = lessToJs(
fs.readFileSync(path.join(__dirname, './src/themes/light/light.style.less'), 'utf8')
);
export default {
entry: {
main: './src/index.js',
},
define: {
__modulename: sys,
themeVariables1: themeVariables1,
themeVariables2: themeVariables2,
},
/**开发模式下的路由配置*/
proxy: {
'/HiatmpPro': {
target:
'http://4.zhuamm.com:8082',
// 'http://192.168.2.200:8082',
// 'http://20.2.11.41:8082',
changeOrigin: true,
pathRewrite: {
// '^/HiatmpPro/': '/eolinker_os/Mock/mock?projectID=3&uri=',
},
}
},
publicPath: '/HiatmpPro/',
extraBabelPlugins: [
[
'import',
{
libraryName: 'antd',
libraryDirectory: 'es',
style: true,
},
],
],
alias: {
themes: resolve(__dirname, './src/themes'),
components: resolve(__dirname, './src/components'),
utils: resolve(__dirname, './src/utils'),
config: resolve(__dirname, './src/config'),
assets: resolve(__dirname, './src/assets'),
services: resolve(__dirname, './src/services'),
models: resolve(__dirname, './src/models'),
routes: resolve(__dirname, './src/routes'),
currentModule: resolve(__dirname, `./src/${sys}`),
},
env: {
development: {
extraBabelPlugins: ['dva-hmr'],
theme: {
'@icon-url': "'/HiatmpPro/iconfont/iconfont'",
},
},
production: {
theme: {
'@icon-url': "'/HiatmpPro/iconfont/iconfont'",
},
},
},
ignoreMomentLocale: true,
html: {
template: './src/index.ejs',
},
publicPath: '/HiatmpPro/',
hash: true,
lessLoaderOptions: {
javascriptEnabled: true,
},
cssLoaderOptions: {
modules: true,
getLocalIdent: (context, localIdentName, localName) => {
if (
context.resourcePath.includes('node_modules') ||
context.resourcePath.includes('ant-design-pro.less')
) {
return localName;
}
const antdProPath = context.resourcePath.match(/src(.*)/)[1].replace('.less', '');
const arr = antdProPath
.split(`${path.sep}`)
.map(a => a.replace(/([A-Z])/g, '-$1'))
.map(a => a.toLowerCase());
return `himap${arr.join('-')}-${localName}`.replace(/--/g, '-');
},
},
};