Skip to content

Commit

Permalink
feat: 增加 TSC_COMPILE_ON_ERROR 减低ts验证导致构建失败的风险
Browse files Browse the repository at this point in the history
  • Loading branch information
xuhongbin committed Nov 6, 2020
1 parent e28c366 commit 1722fbd
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# @Efox EMP CLI Change Log
> change log infomation
## 1.2.8
+ 增加 `TSC_COMPILE_ON_ERROR` 让构建可以忽略ts检测继续进行

## v1.1.20
+ 优化构建报错继续执行完成的通知
+ 美化日志提示
Expand Down
2 changes: 1 addition & 1 deletion packages/emp-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@efox/emp-cli",
"version": "1.2.7",
"version": "1.2.8",
"keywords": [
"react",
"module federation",
Expand Down
27 changes: 18 additions & 9 deletions packages/emp-cli/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,24 @@ module.exports = async args => {
//
if (stats.hasErrors()) {
console.log(chalk.red.bold('\n=== EMP Failed to compile.===\n'))
console.log(
stats.toString({
all: false,
colors: true,
errors: true,
}),
)
process.exit(1)
return
const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true'
if (tscCompileOnError) {
console.log(
chalk.yellow(
'Compiled with the following type errors (you may want to check these before deploying your app):\n',
),
)
} else {
console.log(
stats.toString({
all: false,
colors: true,
errors: true,
}),
)
process.exit(1)
return
}
}
//
console.log(chalk.green.bold('\n=== EMP Compiled successfully.===\n'))
Expand Down
1 change: 1 addition & 0 deletions packages/emp-cli/webpack/config/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = (env, config, args) => {
// cache: false,
optimization: {
chunkIds: 'named',
// minimize: false,
},
entry: {index: entry},
output: {
Expand Down
2 changes: 1 addition & 1 deletion packages/emp-cli/webpack/config/devServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = (env, {hot, open, progress}) => {
historyApiFallback: true,
// open: open === true,
hot: hot === true,
overlay: !hot,
// overlay: !hot,
progress: progress === true,
stats: {
colors: true,
Expand Down
5 changes: 3 additions & 2 deletions projects/antd-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"private": true,
"scripts": {
"dev": "emp dev",
"build": "emp build",
"build": "cross-env TSC_COMPILE_ON_ERROR=true emp build",
"build:ts": "emp build --ts",
"build:analyze": "emp build --analyze",
"start": "emp serve"
Expand All @@ -18,7 +18,8 @@
"@types/loadjs": "^4.0.0",
"@types/react": "^16.9.35",
"@types/react-dom": "^16.9.8",
"@types/react-router-dom": "^5.1.5"
"@types/react-router-dom": "^5.1.5",
"cross-env": "^7.0.2"
},
"dependencies": {
"@efox/emp-tsconfig": "^1.0.0",
Expand Down

0 comments on commit 1722fbd

Please sign in to comment.