前端打包编译报错

  • Choerodon平台版本: 0.21.0

  • 遇到问题的执行步骤:
    前端打包编译报错

  • 源码

{
  "name": "@choerodon/choerodon-front",
  "routeName": "c7n",
  "version": "0.21.0",
  "description": "Choerodon Front",
  "scripts": {
    "start": "choerodon-front-boot start --config ./react/config.js",
    "dist": "node --max_old_space_size=4096 node_modules/@choerodon/boot/bin/choerodon-front-boot-dist --config ./react/config.js",
    "clean": "rm -rf ./src"
  },
  "contributors": [
    "choerodon"
  ],
  "license": "ISC",
  "dependencies": {
    "@choerodon/boot": "0.20.0",
    "@choerodon/master": "0.21.0",
    "choerodon-ui": "^0.8.11",
    "@choerodon/base": "0.21.0",
    "@choerodon/devops": "0.21.0",
    "@choerodon/asgard": "0.21.0",
    "@choerodon/notify": "0.21.0",
    "@choerodon/manager": "0.20.0",
    "@choerodon/agile": "0.21.0",
    "@choerodon/testmanager": "0.21.0",
    "@choerodon/knowledge": "0.21.0"
  }
}
  • 报错日志:
"D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run dist --scripts-prepend-node-path=auto

> @choerodon/choerodon-front@0.21.0 dist D:\github\choerodon-test\choerodon-front
> node --max_old_space_size=4096 node_modules/@choerodon/boot/bin/choerodon-front-boot-dist --config ./react/config.js

�  building modules (134/157 modules)(node:14444) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, se
e https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
�  building modules (7365/7365 modules)Extracted theme color css content length: 47623

webpack: bundle build is now finished.


 ERROR  Failed to compile with 1 errors                                                                                                       9:40:10 PM

This dependency was not found:

* D:\github\choerodon-test\choerodon-front\node_modules\@choerodon\manager\lib\src\app\iam\containers\IAMIndex.js in ./node_modules/@choerodon/boot/tmp/
routes.index.js

To install it, you can run: npm install --save D:\github\choerodon-test\choerodon-front\node_modules\@choerodon\manager\lib\src\app\iam\containers\IAMIn
dex.js
Warning:
ERROR in ./node_modules/@choerodon/boot/tmp/routes.index.js
Module not found: Error: Can't resolve 'D:\github\choerodon-test\choerodon-front\node_modules\@choerodon\manager\lib\src\app\iam\containers\IAMIndex.js'
 in 'D:\github\choerodon-test\choerodon-front\node_modules\@choerodon\boot\tmp'
 @ ./node_modules/@choerodon/boot/tmp/routes.index.js 57:44-177
 @ ./node_modules/@choerodon/boot/tmp/entry.index.js

ERROR in Encountered an error while minifying dis/chunks/303.bfa4c.chunk.js:
SyntaxError: Unexpected token: punc «.»
  59822 |   var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  59823 |
> 59824 |   if (!new.target) throw new Error('ConfigNode() must be called with new');
        |          ^
  59825 |
  59826 |   this.temp = '=';
  59827 |   this.key = key;

Process finished with exit code 0

  • 原因分析:

    可能打包插件出错

您好,您先手动将@choerodon/manager的版本改成0.20.1,再执行命令,我们在修复版本了。

同样报错,报错信息如下

"D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run dist --scripts-prepend-node-path=auto

> @choerodon/choerodon-front@0.21.0 dist D:\github\choerodon-test\choerodon-front
> node --max_old_space_size=4096 node_modules/@choerodon/boot/bin/choerodon-front-boot-dist --config ./react/config.js

�  building modules (134/150 modules)(node:4840) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see
 https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
�  building modules (7466/7466 modules)Extracted theme color css content length: 48202

webpack: bundle build is now finished.


 ERROR  Failed to compile with 1 errors                                                                                                      10:51:07 AM

 error 

Encountered an error while minifying dis/chunks/312.95226.chunk.js:
SyntaxError: Unexpected token: punc «.»
  59364 |   var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  59365 |
> 59366 |   if (!new.target) throw new Error('ConfigNode() must be called with new');
        |          ^
  59367 |
  59368 |   this.temp = '=';
  59369 |   this.key = key;

Warning:
ERROR in Encountered an error while minifying dis/chunks/312.95226.chunk.js:
SyntaxError: Unexpected token: punc «.»
  59364 |   var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  59365 |
> 59366 |   if (!new.target) throw new Error('ConfigNode() must be called with new');
        |          ^
  59367 |
  59368 |   this.temp = '=';
  59369 |   this.key = key;

Process finished with exit code 0

您好,这个报错不影响哈。