Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
kafka-manager
提交
0d635ad4
K
kafka-manager
项目概览
DiDi
/
kafka-manager
8 个月 前同步成功
通知
58
Star
6372
Fork
1229
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kafka-manager
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0d635ad4
编写于
9月 22, 2022
作者:
G
GraceWalk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: webpack 配置结构调整
上级
7eb86a47
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
483 addition
and
334 deletion
+483
-334
km-console/packages/config-manager-fe/config/webpack.common.js
...nsole/packages/config-manager-fe/config/webpack.common.js
+132
-0
km-console/packages/config-manager-fe/config/webpack.dev.js
km-console/packages/config-manager-fe/config/webpack.dev.js
+35
-0
km-console/packages/config-manager-fe/config/webpack.prod.js
km-console/packages/config-manager-fe/config/webpack.prod.js
+59
-0
km-console/packages/config-manager-fe/webpack.config.js
km-console/packages/config-manager-fe/webpack.config.js
+5
-52
km-console/packages/layout-clusters-fe/config/d1-webpack.base.js
...ole/packages/layout-clusters-fe/config/d1-webpack.base.js
+0
-183
km-console/packages/layout-clusters-fe/config/webpack.common.js
...sole/packages/layout-clusters-fe/config/webpack.common.js
+123
-0
km-console/packages/layout-clusters-fe/config/webpack.dev.js
km-console/packages/layout-clusters-fe/config/webpack.dev.js
+45
-0
km-console/packages/layout-clusters-fe/config/webpack.prod.js
...onsole/packages/layout-clusters-fe/config/webpack.prod.js
+79
-0
km-console/packages/layout-clusters-fe/config/webpackConfigResolveAlias.js
...es/layout-clusters-fe/config/webpackConfigResolveAlias.js
+0
-5
km-console/packages/layout-clusters-fe/webpack.config.js
km-console/packages/layout-clusters-fe/webpack.config.js
+5
-94
未找到文件。
km-console/packages/config-manager-fe/config/
d1-webpack.base
.js
→
km-console/packages/config-manager-fe/config/
webpack.common
.js
浏览文件 @
0d635ad4
/* eslint-disable */
const
path
=
require
(
'
path
'
);
const
webpack
=
require
(
'
webpack
'
);
const
HtmlWebpackPlugin
=
require
(
'
html-webpack-plugin
'
);
const
MiniCssExtractPlugin
=
require
(
'
mini-css-extract-plugin
'
);
const
ProgressBarPlugin
=
require
(
'
progress-bar-webpack-plugin
'
);
const
CaseSensitivePathsPlugin
=
require
(
'
case-sensitive-paths-webpack-plugin
'
);
const
StatsPlugin
=
require
(
'
stats-webpack-plugin
'
);
const
{
CleanWebpackPlugin
}
=
require
(
'
clean-webpack-plugin
'
);
const
TerserJSPlugin
=
require
(
'
terser-webpack-plugin
'
);
const
OptimizeCSSAssetsPlugin
=
require
(
'
optimize-css-assets-webpack-plugin
'
);
const
HappyPack
=
require
(
'
happypack
'
);
const
os
=
require
(
'
os
'
);
const
happyThreadPool
=
HappyPack
.
ThreadPool
({
size
:
os
.
cpus
().
length
});
const
ReactRefreshWebpackPlugin
=
require
(
'
@pmmmwh/react-refresh-webpack-plugin
'
);
const
theme
=
require
(
'
./theme
'
);
var
cwd
=
process
.
cwd
(
);
const
pkgJson
=
require
(
'
../package
'
);
const
path
=
require
(
'
path
'
);
const
isProd
=
process
.
env
.
NODE_ENV
===
'
production
'
;
const
devMode
=
process
.
env
.
NODE_ENV
===
'
development
'
;
const
babelOptions
=
{
cacheDirectory
:
true
,
babelrc
:
false
,
...
...
@@ -23,6 +20,7 @@ const babelOptions = {
[
require
.
resolve
(
'
@babel/plugin-proposal-decorators
'
),
{
legacy
:
true
}],
[
require
.
resolve
(
'
@babel/plugin-proposal-class-properties
'
),
{
loose
:
true
}],
[
require
.
resolve
(
'
@babel/plugin-proposal-private-methods
'
),
{
loose
:
true
}],
[
require
.
resolve
(
'
@babel/plugin-proposal-private-property-in-object
'
),
{
loose
:
true
}],
require
.
resolve
(
'
@babel/plugin-proposal-export-default-from
'
),
require
.
resolve
(
'
@babel/plugin-proposal-export-namespace-from
'
),
require
.
resolve
(
'
@babel/plugin-proposal-object-rest-spread
'
),
...
...
@@ -30,31 +28,25 @@ const babelOptions = {
require
.
resolve
(
'
@babel/plugin-proposal-optional-chaining
'
),
//
require
.
resolve
(
'
@babel/plugin-proposal-nullish-coalescing-operator
'
),
// 解决 ?? 无法转义问题
require
.
resolve
(
'
@babel/plugin-proposal-numeric-separator
'
),
// 转义 1_000_000
!
isProd
&&
require
.
resolve
(
'
react-refresh/babel
'
),
]
.
filter
(
Boolean
)
.
concat
([
[
'
babel-plugin-import
'
,
{
libraryName
:
'
antd
'
,
style
:
true
,
},
],
'
@babel/plugin-transform-object-assign
'
,
]),
devMode
&&
require
.
resolve
(
'
react-refresh/babel
'
),
].
filter
(
Boolean
),
};
module
.
exports
=
()
=>
{
const
manifestName
=
`manifest.json`
;
const
cssFileName
=
isProd
?
'
[name]-[chunkhash].css
'
:
'
[name].css
'
;
const
plugins
=
[
module
.
exports
=
{
entry
:
{
[
pkgJson
.
ident
]:
[
'
./src/index.tsx
'
],
},
resolve
:
{
symlinks
:
false
,
extensions
:
[
'
.web.jsx
'
,
'
.web.js
'
,
'
.ts
'
,
'
.tsx
'
,
'
.js
'
,
'
.jsx
'
,
'
.json
'
],
alias
:
{
'
@src
'
:
path
.
resolve
(
process
.
cwd
(),
'
src
'
),
},
},
plugins
:
[
new
ProgressBarPlugin
(),
new
CaseSensitivePathsPlugin
(),
new
MiniCssExtractPlugin
({
filename
:
cssFileName
,
}),
new
StatsPlugin
(
manifestName
,
{
new
StatsPlugin
(
'
manifest.json
'
,
{
chunkModules
:
false
,
source
:
true
,
chunks
:
false
,
...
...
@@ -74,132 +66,67 @@ module.exports = () => {
],
threadPool
:
happyThreadPool
,
}),
!
isProd
&&
new
ReactRefreshWebpackPlugin
({
overlay
:
false
,
}),
// new BundleAnalyzerPlugin({
// analyzerPort: 8889
// }),
].
filter
(
Boolean
);
if
(
isProd
)
{
plugins
.
push
(
new
CleanWebpackPlugin
());
}
return
{
externals
:
isProd
?
[
/^react$/
,
/^react
\/
lib.*/
,
/^react-dom$/
,
/.*react-dom.*/
,
/^single-spa$/
,
/^single-spa-react$/
,
/^moment$/
,
/^antd$/
,
/^lodash$/
,
/^react-router$/
,
/^react-router-dom$/
,
]
:
[],
resolve
:
{
symlinks
:
false
,
extensions
:
[
'
.web.jsx
'
,
'
.web.js
'
,
'
.ts
'
,
'
.tsx
'
,
'
.js
'
,
'
.jsx
'
,
'
.json
'
],
alias
:
{
// '@pkgs': path.resolve(cwd, 'src/packages'),
'
@pkgs
'
:
path
.
resolve
(
cwd
,
'
./node_modules/@didi/d1-packages
'
),
'
@cpts
'
:
path
.
resolve
(
cwd
,
'
src/components
'
),
'
@interface
'
:
path
.
resolve
(
cwd
,
'
src/interface
'
),
'
@apis
'
:
path
.
resolve
(
cwd
,
'
src/api
'
),
react
:
path
.
resolve
(
'
./node_modules/react
'
),
actions
:
path
.
resolve
(
cwd
,
'
src/actions
'
),
lib
:
path
.
resolve
(
cwd
,
'
src/lib
'
),
constants
:
path
.
resolve
(
cwd
,
'
src/constants
'
),
components
:
path
.
resolve
(
cwd
,
'
src/components
'
),
container
:
path
.
resolve
(
cwd
,
'
src/container
'
),
api
:
path
.
resolve
(
cwd
,
'
src/api
'
),
assets
:
path
.
resolve
(
cwd
,
'
src/assets
'
),
mobxStore
:
path
.
resolve
(
cwd
,
'
src/mobxStore
'
),
new
webpack
.
DefinePlugin
({
'
process.env
'
:
{
NODE_ENV
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
),
RUN_ENV
:
JSON
.
stringify
(
process
.
env
.
RUN_ENV
),
},
},
plugins
,
module
:
{
rules
:
[
{
parser
:
{
system
:
false
},
},
{
test
:
/
\.(
js|jsx|ts|tsx
)
$/
,
exclude
:
/node_modules
\/(?!
react-intl|@didi
\/
dcloud-design
)
/
,
use
:
[
{
loader
:
'
happypack/loader?id=babel
'
,
},
],
},
{
test
:
/
\.(
png|svg|jpeg|jpg|gif|ttf|woff|woff2|eot|pdf
)
$/
,
use
:
[
{
loader
:
'
file-loader
'
,
options
:
{
name
:
'
[name].[ext]
'
,
outputPath
:
'
./assets/image/
'
,
esModule
:
false
,
},
},
],
},
{
test
:
/
\.(
css|less
)
$/
,
use
:
[
{
loader
:
MiniCssExtractPlugin
.
loader
,
},
'
css-loader
'
,
{
loader
:
'
less-loader
'
,
options
:
{
javascriptEnabled
:
true
,
modifyVars
:
theme
,
},
}),
new
HtmlWebpackPlugin
({
meta
:
{
manifest
:
'
manifest.json
'
,
},
template
:
'
./src/index.html
'
,
inject
:
'
body
'
,
}),
].
filter
(
Boolean
),
module
:
{
rules
:
[
{
parser
:
{
system
:
false
},
},
{
test
:
/
\.(
js|jsx|ts|tsx
)
$/
,
exclude
:
/node_modules
\/(?!
react-intl|@didi
\/
dcloud-design
)
/
,
use
:
[
{
loader
:
'
happypack/loader?id=babel
'
,
},
],
},
{
test
:
/
\.(
png|svg|jpeg|jpg|gif|ttf|woff|woff2|eot|pdf
)
$/
,
use
:
[
{
loader
:
'
file-loader
'
,
options
:
{
name
:
'
[name].[ext]
'
,
outputPath
:
'
./assets/image/
'
,
esModule
:
false
,
},
],
},
],
},
optimization
:
Object
.
assign
(
},
],
},
{
splitChunks
:
{
cacheGroups
:
{
vendor
:
{
test
:
/
[\\/]
node_modules
[\\/]
/
,
chunks
:
'
all
'
,
name
:
'
vendor
'
,
priority
:
10
,
enforce
:
true
,
minChunks
:
1
,
maxSize
:
3500000
,
test
:
/
\.(
css|less
)
$/
,
use
:
[
MiniCssExtractPlugin
.
loader
,
'
css-loader
'
,
{
loader
:
'
less-loader
'
,
options
:
{
javascriptEnabled
:
true
,
modifyVars
:
theme
,
},
},
}
,
]
,
},
isProd
?
{
minimizer
:
[
new
TerserJSPlugin
({
cache
:
true
,
sourceMap
:
true
,
}),
new
OptimizeCSSAssetsPlugin
({}),
],
}
:
{}
),
devtool
:
isProd
?
'
cheap-module-source-map
'
:
'
source-map
'
,
node
:
{
fs
:
'
empty
'
,
net
:
'
empty
'
,
tls
:
'
empty
'
,
},
};
],
},
node
:
{
fs
:
'
empty
'
,
net
:
'
empty
'
,
tls
:
'
empty
'
,
},
stats
:
'
errors-warnings
'
,
};
km-console/packages/config-manager-fe/config/webpack.dev.js
0 → 100644
浏览文件 @
0d635ad4
const
MiniCssExtractPlugin
=
require
(
'
mini-css-extract-plugin
'
);
const
ReactRefreshWebpackPlugin
=
require
(
'
@pmmmwh/react-refresh-webpack-plugin
'
);
const
pkgJson
=
require
(
'
../package
'
);
module
.
exports
=
{
mode
:
'
development
'
,
plugins
:
[
new
MiniCssExtractPlugin
(),
new
ReactRefreshWebpackPlugin
({
overlay
:
false
,
}),
],
devServer
:
{
host
:
'
127.0.0.1
'
,
port
:
pkgJson
.
port
,
hot
:
true
,
open
:
false
,
publicPath
:
`http://localhost:
${
pkgJson
.
port
}
/
${
pkgJson
.
ident
}
/`
,
inline
:
true
,
disableHostCheck
:
true
,
historyApiFallback
:
true
,
headers
:
{
'
Access-Control-Allow-Origin
'
:
'
*
'
,
},
},
output
:
{
path
:
'
/
'
,
publicPath
:
`http://localhost:
${
pkgJson
.
port
}
/
${
pkgJson
.
ident
}
/`
,
library
:
pkgJson
.
ident
,
libraryTarget
:
'
amd
'
,
filename
:
'
[name].js
'
,
chunkFilename
:
'
[name].js
'
,
},
devtool
:
'
cheap-module-eval-source-map
'
,
};
km-console/packages/config-manager-fe/config/webpack.prod.js
0 → 100644
浏览文件 @
0d635ad4
const
path
=
require
(
'
path
'
);
const
MiniCssExtractPlugin
=
require
(
'
mini-css-extract-plugin
'
);
const
{
CleanWebpackPlugin
}
=
require
(
'
clean-webpack-plugin
'
);
const
TerserJSPlugin
=
require
(
'
terser-webpack-plugin
'
);
const
OptimizeCSSAssetsPlugin
=
require
(
'
optimize-css-assets-webpack-plugin
'
);
const
pkgJson
=
require
(
'
../package
'
);
module
.
exports
=
{
mode
:
'
production
'
,
externals
:
[
/^react$/
,
/^react
\/
lib.*/
,
/^react-dom$/
,
/.*react-dom.*/
,
/^single-spa$/
,
/^single-spa-react$/
,
/^moment$/
,
/^lodash$/
,
/^react-router$/
,
/^react-router-dom$/
,
],
plugins
:
[
new
CleanWebpackPlugin
(),
new
MiniCssExtractPlugin
({
filename
:
'
[name]-[chunkhash].css
'
,
}),
],
output
:
{
path
:
path
.
resolve
(
process
.
cwd
(),
`../../../km-rest/src/main/resources/templates/
${
pkgJson
.
ident
}
`
),
publicPath
:
`
${
process
.
env
.
PUBLIC_PATH
}
/
${
pkgJson
.
ident
}
/`
,
library
:
pkgJson
.
ident
,
libraryTarget
:
'
amd
'
,
filename
:
'
[name]-[chunkhash].js
'
,
chunkFilename
:
'
[name]-[chunkhash].js
'
,
},
optimization
:
{
splitChunks
:
{
cacheGroups
:
{
vendor
:
{
test
:
/
[\\/]
node_modules
[\\/]
/
,
chunks
:
'
all
'
,
name
:
'
vendor
'
,
priority
:
10
,
enforce
:
true
,
minChunks
:
1
,
maxSize
:
3500000
,
},
},
},
minimizer
:
[
new
TerserJSPlugin
({
cache
:
true
,
sourceMap
:
true
,
}),
new
OptimizeCSSAssetsPlugin
({}),
],
},
devtool
:
'
none
'
,
};
km-console/packages/config-manager-fe/webpack.config.js
浏览文件 @
0d635ad4
/* eslint-disable */
const
path
=
require
(
'
path
'
);
require
(
'
dotenv
'
).
config
({
path
:
path
.
resolve
(
process
.
cwd
(),
'
../../.env
'
)
});
const
isProd
=
process
.
env
.
NODE_ENV
===
'
production
'
;
const
HtmlWebpackPlugin
=
require
(
'
html-webpack-plugin
'
);
const
webpack
=
require
(
'
webpack
'
);
const
merge
=
require
(
'
webpack-merge
'
);
const
pkgJson
=
require
(
'
./package
'
)
;
const
getWebpackCommonConfig
=
require
(
'
./config/d1-webpack.base
'
);
const
outPath
=
path
.
resolve
(
__dirname
,
`../../../km-rest/src/main/resources/templates/
${
pkgJson
.
ident
}
`
);
const
jsFileName
=
isProd
?
'
[name]-[chunkhash].js
'
:
'
[name].js
'
;
const
devMode
=
process
.
env
.
NODE_ENV
===
'
development
'
;
const
commonConfig
=
require
(
'
./config/webpack.common
'
);
const
devConfig
=
require
(
'
./config/webpack.dev
'
);
const
prodConfig
=
require
(
'
./config/webpack.prod
'
)
;
module
.
exports
=
merge
(
getWebpackCommonConfig
(),
{
mode
:
isProd
?
'
production
'
:
'
development
'
,
entry
:
{
[
pkgJson
.
ident
]:
[
'
./src/index.tsx
'
],
},
plugins
:
[
new
webpack
.
DefinePlugin
({
'
process.env
'
:
{
NODE_ENV
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
),
RUN_ENV
:
JSON
.
stringify
(
process
.
env
.
RUN_ENV
),
},
}),
new
HtmlWebpackPlugin
({
meta
:
{
manifest
:
'
manifest.json
'
,
},
template
:
'
./src/index.html
'
,
inject
:
'
body
'
,
}),
],
output
:
{
path
:
outPath
,
publicPath
:
isProd
?
`
${
process
.
env
.
PUBLIC_PATH
}
/
${
pkgJson
.
ident
}
/`
:
`http://localhost:
${
pkgJson
.
port
}
/
${
pkgJson
.
ident
}
/`
,
library
:
pkgJson
.
ident
,
libraryTarget
:
'
amd
'
,
filename
:
jsFileName
,
chunkFilename
:
jsFileName
,
},
devtool
:
isProd
?
'
none
'
:
'
cheap-module-eval-source-map
'
,
devServer
:
{
host
:
'
127.0.0.1
'
,
port
:
pkgJson
.
port
,
hot
:
true
,
open
:
false
,
publicPath
:
`http://localhost:
${
pkgJson
.
port
}
/
${
pkgJson
.
ident
}
/`
,
inline
:
true
,
disableHostCheck
:
true
,
historyApiFallback
:
true
,
headers
:
{
'
Access-Control-Allow-Origin
'
:
'
*
'
,
},
proxy
:
{},
},
});
module
.
exports
=
merge
(
commonConfig
,
devMode
?
devConfig
:
prodConfig
);
km-console/packages/layout-clusters-fe/config/d1-webpack.base.js
已删除
100644 → 0
浏览文件 @
7eb86a47
/* eslint-disable */
const
MiniCssExtractPlugin
=
require
(
'
mini-css-extract-plugin
'
);
const
ProgressBarPlugin
=
require
(
'
progress-bar-webpack-plugin
'
);
const
CaseSensitivePathsPlugin
=
require
(
'
case-sensitive-paths-webpack-plugin
'
);
const
{
CleanWebpackPlugin
}
=
require
(
'
clean-webpack-plugin
'
);
const
CoverHtmlWebpackPlugin
=
require
(
'
./CoverHtmlWebpackPlugin.js
'
);
var
webpackConfigResolveAlias
=
require
(
'
./webpackConfigResolveAlias
'
);
const
TerserJSPlugin
=
require
(
'
terser-webpack-plugin
'
);
const
OptimizeCSSAssetsPlugin
=
require
(
'
optimize-css-assets-webpack-plugin
'
);
const
theme
=
require
(
'
./theme
'
);
const
ReactRefreshWebpackPlugin
=
require
(
'
@pmmmwh/react-refresh-webpack-plugin
'
);
const
isProd
=
process
.
env
.
NODE_ENV
===
'
production
'
;
const
babelOptions
=
{
cacheDirectory
:
true
,
babelrc
:
false
,
presets
:
[
require
.
resolve
(
'
@babel/preset-env
'
),
require
.
resolve
(
'
@babel/preset-typescript
'
),
require
.
resolve
(
'
@babel/preset-react
'
)],
plugins
:
[
[
require
.
resolve
(
'
@babel/plugin-proposal-decorators
'
),
{
legacy
:
true
}],
[
require
.
resolve
(
'
@babel/plugin-proposal-class-properties
'
),
{
loose
:
true
}],
[
require
.
resolve
(
'
@babel/plugin-proposal-private-property-in-object
'
),
{
loose
:
true
}],
[
require
.
resolve
(
'
@babel/plugin-proposal-private-methods
'
),
{
loose
:
true
}],
require
.
resolve
(
'
@babel/plugin-proposal-export-default-from
'
),
require
.
resolve
(
'
@babel/plugin-proposal-export-namespace-from
'
),
require
.
resolve
(
'
@babel/plugin-proposal-object-rest-spread
'
),
require
.
resolve
(
'
@babel/plugin-transform-runtime
'
),
!
isProd
&&
require
.
resolve
(
'
react-refresh/babel
'
),
]
.
filter
(
Boolean
)
.
concat
([
[
'
babel-plugin-import
'
,
{
libraryName
:
'
antd
'
,
style
:
true
,
},
],
'
@babel/plugin-transform-object-assign
'
,
]),
};
module
.
exports
=
()
=>
{
const
cssFileName
=
isProd
?
'
[name]-[chunkhash].css
'
:
'
[name].css
'
;
const
plugins
=
[
new
CoverHtmlWebpackPlugin
(),
new
ProgressBarPlugin
(),
new
CaseSensitivePathsPlugin
(),
new
MiniCssExtractPlugin
({
filename
:
cssFileName
,
}),
!
isProd
&&
new
ReactRefreshWebpackPlugin
({
overlay
:
false
,
}),
].
filter
(
Boolean
);
const
resolve
=
{
symlinks
:
false
,
extensions
:
[
'
.web.jsx
'
,
'
.web.js
'
,
'
.ts
'
,
'
.tsx
'
,
'
.js
'
,
'
.jsx
'
,
'
.json
'
],
alias
:
webpackConfigResolveAlias
,
};
if
(
isProd
)
{
plugins
.
push
(
new
CleanWebpackPlugin
());
}
if
(
!
isProd
)
{
resolve
.
mainFields
=
[
'
module
'
,
'
browser
'
,
'
main
'
];
}
return
{
externals
:
isProd
?
[
/^react$/
,
/^react
\/
lib.*/
,
/^react-dom$/
,
/.*react-dom.*/
,
/^single-spa$/
,
/^single-spa-react$/
,
/^moment$/
,
/^antd$/
,
/^lodash$/
,
/^echarts$/
,
/^react-router$/
,
/^react-router-dom$/
,
]
:
[],
resolve
,
plugins
,
module
:
{
rules
:
[
{
parser
:
{
system
:
false
},
},
{
test
:
/
\.(
js|jsx
)
$/
,
exclude
:
/node_modules/
,
use
:
[
{
loader
:
'
babel-loader
'
,
options
:
babelOptions
,
},
],
},
{
test
:
/
\.(
ts|tsx
)
$/
,
use
:
[
{
loader
:
'
babel-loader
'
,
options
:
babelOptions
,
},
{
loader
:
'
ts-loader
'
,
options
:
{
allowTsInNodeModules
:
true
,
},
},
],
},
{
test
:
/
\.(
png|svg|jpeg|jpg|gif|ttf|woff|woff2|eot|pdf|otf
)
$/
,
use
:
[
{
loader
:
'
file-loader
'
,
options
:
{
name
:
'
[name].[ext]
'
,
outputPath
:
'
./assets/image/
'
,
esModule
:
false
,
},
},
],
},
{
test
:
/
\.(
css|less
)
$/
,
use
:
[
{
loader
:
MiniCssExtractPlugin
.
loader
,
},
'
css-loader
'
,
{
loader
:
'
less-loader
'
,
options
:
{
javascriptEnabled
:
true
,
modifyVars
:
theme
,
},
},
],
},
],
},
optimization
:
Object
.
assign
(
isProd
?
{
splitChunks
:
{
cacheGroups
:
{
vendor
:
{
test
:
/
[\\/]
node_modules
[\\/]
/
,
chunks
:
'
all
'
,
name
:
'
vendor
'
,
priority
:
10
,
enforce
:
true
,
minChunks
:
1
,
maxSize
:
3000000
,
},
},
},
minimizer
:
[
new
TerserJSPlugin
({
cache
:
true
,
sourceMap
:
true
,
}),
new
OptimizeCSSAssetsPlugin
({}),
],
}
:
{}
),
devtool
:
isProd
?
'
cheap-module-source-map
'
:
''
,
node
:
{
fs
:
'
empty
'
,
net
:
'
empty
'
,
tls
:
'
empty
'
,
},
};
};
km-console/packages/layout-clusters-fe/config/webpack.common.js
0 → 100644
浏览文件 @
0d635ad4
const
path
=
require
(
'
path
'
);
const
theme
=
require
(
'
./theme
'
);
const
webpack
=
require
(
'
webpack
'
);
const
HtmlWebpackPlugin
=
require
(
'
html-webpack-plugin
'
);
const
MiniCssExtractPlugin
=
require
(
'
mini-css-extract-plugin
'
);
const
ProgressBarPlugin
=
require
(
'
progress-bar-webpack-plugin
'
);
const
CoverHtmlWebpackPlugin
=
require
(
'
./CoverHtmlWebpackPlugin.js
'
);
const
CaseSensitivePathsPlugin
=
require
(
'
case-sensitive-paths-webpack-plugin
'
);
const
devMode
=
process
.
env
.
NODE_ENV
===
'
development
'
;
const
babelOptions
=
{
cacheDirectory
:
true
,
babelrc
:
false
,
presets
:
[
require
.
resolve
(
'
@babel/preset-env
'
),
require
.
resolve
(
'
@babel/preset-typescript
'
),
require
.
resolve
(
'
@babel/preset-react
'
)],
plugins
:
[
[
require
.
resolve
(
'
@babel/plugin-proposal-decorators
'
),
{
legacy
:
true
}],
[
require
.
resolve
(
'
@babel/plugin-proposal-class-properties
'
),
{
loose
:
true
}],
[
require
.
resolve
(
'
@babel/plugin-proposal-private-property-in-object
'
),
{
loose
:
true
}],
[
require
.
resolve
(
'
@babel/plugin-proposal-private-methods
'
),
{
loose
:
true
}],
require
.
resolve
(
'
@babel/plugin-proposal-export-default-from
'
),
require
.
resolve
(
'
@babel/plugin-proposal-export-namespace-from
'
),
require
.
resolve
(
'
@babel/plugin-proposal-object-rest-spread
'
),
require
.
resolve
(
'
@babel/plugin-transform-runtime
'
),
devMode
&&
require
.
resolve
(
'
react-refresh/babel
'
),
devMode
&&
[
'
babel-plugin-import
'
,
{
libraryName
:
'
antd
'
,
style
:
true
,
},
],
].
filter
(
Boolean
),
};
module
.
exports
=
{
entry
:
{
layout
:
[
'
./src/index.tsx
'
],
},
resolve
:
{
symlinks
:
false
,
extensions
:
[
'
.web.jsx
'
,
'
.web.js
'
,
'
.ts
'
,
'
.tsx
'
,
'
.js
'
,
'
.jsx
'
,
'
.json
'
],
alias
:
{
'
@src
'
:
path
.
resolve
(
'
src
'
),
},
},
plugins
:
[
new
CoverHtmlWebpackPlugin
(),
new
ProgressBarPlugin
(),
new
CaseSensitivePathsPlugin
(),
new
webpack
.
DefinePlugin
({
'
process.env
'
:
{
NODE_ENV
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
),
RUN_ENV
:
JSON
.
stringify
(
process
.
env
.
RUN_ENV
),
BUSINESS_VERSION
:
process
.
env
.
BUSINESS_VERSION
===
'
true
'
,
PUBLIC_PATH
:
JSON
.
stringify
(
process
.
env
.
PUBLIC_PATH
),
},
}),
new
HtmlWebpackPlugin
({
meta
:
{
manifest
:
'
manifest.json
'
,
},
template
:
'
./src/index.html
'
,
favicon
:
path
.
resolve
(
'
favicon.ico
'
),
inject
:
'
body
'
,
}),
],
module
:
{
rules
:
[
{
parser
:
{
system
:
false
},
},
{
test
:
/
\.(
js|jsx|ts|tsx
)
$/
,
exclude
:
/node_modules/
,
use
:
[
{
loader
:
'
babel-loader
'
,
options
:
babelOptions
,
},
{
loader
:
'
ts-loader
'
,
options
:
{
allowTsInNodeModules
:
true
,
},
},
],
},
{
test
:
/
\.(
png|svg|jpeg|jpg|gif|ttf|woff|woff2|eot|pdf|otf
)
$/
,
use
:
[
{
loader
:
'
file-loader
'
,
options
:
{
name
:
'
[name].[ext]
'
,
outputPath
:
'
./assets/image/
'
,
esModule
:
false
,
},
},
],
},
{
test
:
/
\.(
css|less
)
$/
,
use
:
[
MiniCssExtractPlugin
.
loader
,
'
css-loader
'
,
{
loader
:
'
less-loader
'
,
options
:
{
javascriptEnabled
:
true
,
modifyVars
:
theme
,
},
},
],
},
],
},
node
:
{
fs
:
'
empty
'
,
net
:
'
empty
'
,
tls
:
'
empty
'
,
},
stats
:
'
errors-warnings
'
,
};
km-console/packages/layout-clusters-fe/config/webpack.dev.js
0 → 100644
浏览文件 @
0d635ad4
const
MiniCssExtractPlugin
=
require
(
'
mini-css-extract-plugin
'
);
const
ReactRefreshWebpackPlugin
=
require
(
'
@pmmmwh/react-refresh-webpack-plugin
'
);
module
.
exports
=
{
mode
:
'
development
'
,
plugins
:
[
new
MiniCssExtractPlugin
(),
new
ReactRefreshWebpackPlugin
({
overlay
:
false
,
}),
],
output
:
{
path
:
'
/
'
,
publicPath
:
'
/
'
,
filename
:
'
[name].js
'
,
chunkFilename
:
'
[name].js
'
,
library
:
'
layout
'
,
libraryTarget
:
'
amd
'
,
},
devServer
:
{
host
:
'
localhost
'
,
port
:
8000
,
hot
:
true
,
open
:
true
,
openPage
:
'
http://localhost:8000/
'
,
inline
:
true
,
historyApiFallback
:
true
,
publicPath
:
`http://localhost:8000/`
,
headers
:
{
'
cache-control
'
:
'
no-cache
'
,
pragma
:
'
no-cache
'
,
'
Access-Control-Allow-Origin
'
:
'
*
'
,
},
proxy
:
{
'
/ks-km/api/v3
'
:
{
changeOrigin
:
true
,
target
:
'
https://api-kylin-xg02.intra.xiaojukeji.com/ks-km/
'
,
},
'
/logi-security/api/v1
'
:
{
changeOrigin
:
true
,
target
:
'
https://api-kylin-xg02.intra.xiaojukeji.com/ks-km/
'
,
},
},
},
};
km-console/packages/layout-clusters-fe/config/webpack.prod.js
0 → 100644
浏览文件 @
0d635ad4
const
path
=
require
(
'
path
'
);
const
{
CleanWebpackPlugin
}
=
require
(
'
clean-webpack-plugin
'
);
const
CountPlugin
=
require
(
'
./CountComponentWebpackPlugin
'
);
const
MiniCssExtractPlugin
=
require
(
'
mini-css-extract-plugin
'
);
const
CopyWebpackPlugin
=
require
(
'
copy-webpack-plugin
'
);
const
TerserJSPlugin
=
require
(
'
terser-webpack-plugin
'
);
const
OptimizeCSSAssetsPlugin
=
require
(
'
optimize-css-assets-webpack-plugin
'
);
const
outputPath
=
path
.
resolve
(
process
.
cwd
(),
`../../../km-rest/src/main/resources/templates/layout`
);
module
.
exports
=
{
mode
:
'
production
'
,
plugins
:
[
new
CleanWebpackPlugin
(),
new
CountPlugin
({
pathname
:
'
knowdesign
'
,
startCount
:
true
,
isExportExcel
:
false
,
}),
new
MiniCssExtractPlugin
({
filename
:
'
[name]-[chunkhash].css
'
,
}),
new
CopyWebpackPlugin
([
{
from
:
path
.
resolve
(
process
.
cwd
(),
'
static
'
),
to
:
path
.
resolve
(
outputPath
,
'
../static
'
),
},
{
from
:
path
.
resolve
(
process
.
cwd
(),
'
favicon.ico
'
),
to
:
path
.
resolve
(
outputPath
,
'
../favicon.ico
'
),
},
]),
],
externals
:
[
/^react$/
,
/^react
\/
lib.*/
,
/^react-dom$/
,
/.*react-dom.*/
,
/^single-spa$/
,
/^single-spa-react$/
,
/^moment$/
,
/^antd$/
,
/^lodash$/
,
/^echarts$/
,
/^react-router$/
,
/^react-router-dom$/
,
],
output
:
{
path
:
outputPath
,
publicPath
:
process
.
env
.
PUBLIC_PATH
+
'
/layout/
'
,
filename
:
'
[name]-[chunkhash].js
'
,
chunkFilename
:
'
[name]-[chunkhash].js
'
,
library
:
'
layout
'
,
libraryTarget
:
'
amd
'
,
},
optimization
:
{
splitChunks
:
{
cacheGroups
:
{
vendor
:
{
test
:
/
[\\/]
node_modules
[\\/]
/
,
chunks
:
'
all
'
,
name
:
'
vendor
'
,
priority
:
10
,
enforce
:
true
,
minChunks
:
1
,
maxSize
:
3000000
,
},
},
},
minimizer
:
[
new
TerserJSPlugin
({
cache
:
true
,
sourceMap
:
true
,
}),
new
OptimizeCSSAssetsPlugin
({}),
],
},
devtool
:
'
none
'
,
};
km-console/packages/layout-clusters-fe/config/webpackConfigResolveAlias.js
已删除
100755 → 0
浏览文件 @
7eb86a47
var
path
=
require
(
'
path
'
);
module
.
exports
=
{
react
:
path
.
resolve
(
'
./node_modules/react
'
),
};
km-console/packages/layout-clusters-fe/webpack.config.js
浏览文件 @
0d635ad4
const
path
=
require
(
'
path
'
);
require
(
'
dotenv
'
).
config
({
path
:
path
.
resolve
(
process
.
cwd
(),
'
../../.env
'
)
});
const
webpack
=
require
(
'
webpack
'
);
const
merge
=
require
(
'
webpack-merge
'
);
const
CopyWebpackPlugin
=
require
(
'
copy-webpack-plugin
'
);
const
HtmlWebpackPlugin
=
require
(
'
html-webpack-plugin
'
);
const
getWebpackCommonConfig
=
require
(
'
./config/d1-webpack.base
'
);
const
CountPlugin
=
require
(
'
./config/CountComponentWebpackPlugin
'
);
const
isProd
=
process
.
env
.
NODE_ENV
===
'
production
'
;
const
jsFileName
=
isProd
?
'
[name]-[chunkhash].js
'
:
'
[name].js
'
;
const
outPath
=
path
.
resolve
(
__dirname
,
`../../../km-rest/src/main/resources/templates/layout`
);
module
.
exports
=
merge
(
getWebpackCommonConfig
(),
{
mode
:
isProd
?
'
production
'
:
'
development
'
,
entry
:
{
layout
:
[
'
./src/index.tsx
'
],
},
plugins
:
[
isProd
?
new
CountPlugin
({
pathname
:
'
knowdesign
'
,
startCount
:
true
,
isExportExcel
:
false
,
})
:
undefined
,
new
webpack
.
DefinePlugin
({
'
process.env
'
:
{
NODE_ENV
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
),
RUN_ENV
:
JSON
.
stringify
(
process
.
env
.
RUN_ENV
),
BUSINESS_VERSION
:
process
.
env
.
BUSINESS_VERSION
===
'
true
'
,
PUBLIC_PATH
:
JSON
.
stringify
(
process
.
env
.
PUBLIC_PATH
),
},
}),
new
HtmlWebpackPlugin
({
meta
:
{
manifest
:
'
manifest.json
'
,
},
template
:
'
./src/index.html
'
,
favicon
:
path
.
resolve
(
'
favicon.ico
'
),
inject
:
'
body
'
,
}),
new
CopyWebpackPlugin
(
[
{
from
:
path
.
resolve
(
__dirname
,
'
static
'
),
to
:
path
.
resolve
(
outPath
,
'
../static
'
),
},
].
concat
(
isProd
?
[
{
from
:
path
.
resolve
(
__dirname
,
'
favicon.ico
'
),
to
:
path
.
resolve
(
outPath
,
'
../favicon.ico
'
),
},
]
:
[]
)
),
].
filter
((
p
)
=>
p
),
output
:
{
path
:
outPath
,
publicPath
:
isProd
?
process
.
env
.
PUBLIC_PATH
+
'
/layout/
'
:
'
/
'
,
filename
:
jsFileName
,
chunkFilename
:
jsFileName
,
library
:
'
layout
'
,
libraryTarget
:
'
amd
'
,
},
devServer
:
{
host
:
'
localhost
'
,
port
:
8000
,
hot
:
true
,
open
:
true
,
openPage
:
'
http://localhost:8000/
'
,
inline
:
true
,
historyApiFallback
:
true
,
publicPath
:
`http://localhost:8000/`
,
headers
:
{
'
cache-control
'
:
'
no-cache
'
,
pragma
:
'
no-cache
'
,
'
Access-Control-Allow-Origin
'
:
'
*
'
,
},
proxy
:
{
'
/ks-km/api/v3
'
:
{
changeOrigin
:
true
,
target
:
'
http://localhost:8080/
'
,
},
'
/logi-security/api/v1
'
:
{
changeOrigin
:
true
,
target
:
'
http://localhost:8080/
'
,
},
},
},
const
devMode
=
process
.
env
.
NODE_ENV
===
'
development
'
;
const
commonConfig
=
require
(
'
./config/webpack.common
'
);
const
devConfig
=
require
(
'
./config/webpack.dev
'
);
const
prodConfig
=
require
(
'
./config/webpack.prod
'
);
resolve
:
{
alias
:
{
'
@src
'
:
path
.
resolve
(
__dirname
,
'
src
'
),
},
},
});
module
.
exports
=
merge
(
commonConfig
,
devMode
?
devConfig
:
prodConfig
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录