Git 源码yarn build 插件核心插件报异常

E:\code\tongdaCode\nocobase>yarn build @tdcktz/plugin-workflow-js
yarn run v1.22.22
$ nocobase build @tdcktz/plugin-workflow-js
$ tsup
@tdcktz/plugin-workflow-js: plugins/@tdcktz/plugin-workflow-js build start
@tdcktz/plugin-workflow-js: build plugin client
asset index.js 15.3 KiB [emitted] (name: main)
orphan modules 27.4 KiB [orphan] 5 modules
runtime modules 971 bytes 4 modules
cacheable modules 27.7 KiB
modules by path external "@nocobase/ 126 bytes
external “@nocobase/client” 42 bytes [built] [code generated]
external “@nocobase/utils/client” 42 bytes [built] [code generated]
external “@nocobase/plugin-workflow/client” 42 bytes [built] [code generated]
./src/client/index.tsx + 4 modules 27.4 KiB [code generated]
external “react” 42 bytes [built] [code generated]
external “@formily/antd-v5” 42 bytes [built] [code generated]
external “@ant-design/icons” 42 bytes [built] [code generated]
external “react-i18next” 42 bytes [built] [code generated]
Rspack 1.3.2 compiled successfully in 594 ms
@tdcktz/plugin-workflow-js: build plugin server source
@tdcktz/plugin-workflow-js: delete server files
@tdcktz/plugin-workflow-js: build plugin server dependencies
@tdcktz/plugin-workflow-js: These packages react-i18next, @nocobase/plugin-workflow, @nocobase/server will be exclude. For more information, please refer to: https://docs.nocobase.com/development/others/deps.
@tdcktz/plugin-workflow-js: write external version
@tdcktz/plugin-workflow-js: build declaration
E:/code/tongdaCode/nocobase/packages/core/database/lib/collection.js(1,1): error TS9006: Declaration emit for this file requires using private name ‘StaticEventEmitterOptions’ from module ‘“events”’. An explicit type annotation may unblock declaration emit.
E:/code/tongdaCode/nocobase/packages/core/database/lib/collection.js(1,1): error TS9006: Declaration emit for this file requires using private name ‘_DOMEventTarget’ from module ‘“events”’. An explicit type annotation may unblock declaration emit.
E:/code/tongdaCode/nocobase/packages/core/database/lib/collection.js(1,1): error TS9006: Declaration emit for this file requires using private name ‘_NodeEventTarget’ from module ‘“events”’. An explicit type annotation may unblock declaration emit.
E:/code/tongdaCode/nocobase/packages/core/database/lib/database.js(1,1): error TS9006: Declaration emit for this file requires using private name ‘StaticEventEmitterOptions’ from module ‘“events”’. An explicit type annotation may unblock declaration emit.
E:/code/tongdaCode/nocobase/packages/core/database/lib/database.js(1,1): error TS9006: Declaration emit for this file requires using private name ‘_DOMEventTarget’ from module ‘“events”’. An explicit type annotation may unblock declaration emit.
E:/code/tongdaCode/nocobase/packages/core/database/lib/database.js(1,1): error TS9006: Declaration emit for this file requires using private name ‘_NodeEventTarget’ from module ‘“events”’. An explicit type annotation may unblock declaration emit.
E:/code/tongdaCode/nocobase/packages/core/database/lib/fields/relation-field.js(1,1): error TS9005: Declaration emit for this file requires using private name ‘_RelationField.TargetModel’. An explicit type annotation may unblock declaration emit.
TypeScript: 17 declaration errors
TypeScript: -10 emit errors
TypeScript: emit succeeded (with errors)
E:\code\tongdaCode\nocobase\node_modules\gulp-typescript\release\output.js:131
this.streamFull.emit(‘error’, new Error(“TypeScript: Compilation failed”));
^

Error: TypeScript: Compilation failed
at Output.mightFinish (E:\code\tongdaCode\nocobase\node_modules\gulp-typescript\release\output.js:131:43)
at E:\code\tongdaCode\nocobase\node_modules\gulp-typescript\release\output.js:66:22
at processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted ‘error’ event on CompileStream instance at:
at E:\code\tongdaCode\nocobase\node_modules\gulp-typescript\release\output.js:117:29
at processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.19.3
E:\code\tongdaCode\nocobase\node_modules\execa\lib\error.js:60
error = new Error(message);
^

Error: Command failed with exit code 1: nocobase-build @tdcktz/plugin-workflow-js
at makeError (E:\code\tongdaCode\nocobase\node_modules\execa\lib\error.js:60:11)
at handlePromise (E:\code\tongdaCode\nocobase\node_modules\execa\index.js:118:26)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Command. (E:\code\tongdaCode\nocobase\packages\core\cli\src\commands\build.js:40:7) {
shortMessage: 'Command failed with exit code 1: nocobase-build @tdcktz/plugin-workflow-js ',
command: 'nocobase-build @tdcktz/plugin-workflow-js ',
escapedCommand: ‘nocobase-build “@tdcktz/plugin-workflow-js” “” “” “” “”’,
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: undefined,
stderr: undefined,
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}

Node.js v20.19.3
error Command failed with exit code 1.
info Visit yarn run | Yarn for documentation about this command.

E:\code\tongdaCode\nocobase>

核心仓库的代码我没有修改但是为什么验证会报错呢?拉取自main分支昨天的最新代码

忽然发现:
yarn build @tdcktz/plugin-workflow-js --tar --no-dts

可以跳开声明,这样有什么问题吗

在首次 build 插件之前,需要先 build 内核,yarn build packages/core

(TraeAI-8) E:\code\tongdaCode\nocobase [1:1] $ yarn build packages/core
yarn run v1.22.22
$ nocobase build packages/core
$ tsup
create-nocobase-app: core/create-nocobase-app build start
create-nocobase-app: build cjs
create-nocobase-app: build declaration
@nocobase/logger: core/logger build start
@nocobase/logger: build cjs
@nocobase/logger: build declaration
@nocobase/sdk: core/sdk build start
@nocobase/sdk: build cjs
@nocobase/sdk: build declaration
@nocobase/utils: core/utils build start
@nocobase/utils: build cjs
@nocobase/utils: build declaration
@nocobase/database: core/database build start
@nocobase/database: build cjs
@nocobase/database: build declaration
E:/code/tongdaCode/nocobase/packages/core/database/lib/collection.js(1,1): error TS9006: Declaration emit for this file requires using private name 'StaticEventEmitterOptions' from module '"events"'. An explicit type annotation may unblock declaration emit.
E:/code/tongdaCode/nocobase/packages/core/database/lib/collection.js(1,1): error TS9006: Declaration emit for this file requires using private name '_DOMEventTarget' from module '"events"'. An explicit type annotation may unblock declaration emit.  
E:/code/tongdaCode/nocobase/packages/core/database/lib/collection.js(1,1): error TS9006: Declaration emit for this file requires using private name '_NodeEventTarget' from module '"events"'. An explicit type annotation may unblock declaration emit. 
E:/code/tongdaCode/nocobase/packages/core/database/lib/database.js(1,1): error TS9006: Declaration emit for this file requires using private name 'StaticEventEmitterOptions' from module '"events"'. An explicit type annotation may unblock declaration emit.
E:/code/tongdaCode/nocobase/packages/core/database/lib/database.js(1,1): error TS9006: Declaration emit for this file requires using private name '_DOMEventTarget' from module '"events"'. An explicit type annotation may unblock declaration emit.    
E:/code/tongdaCode/nocobase/packages/core/database/lib/database.js(1,1): error TS9006: Declaration emit for this file requires using private name '_NodeEventTarget' from module '"events"'. An explicit type annotation may unblock declaration emit.   
E:/code/tongdaCode/nocobase/packages/core/database/lib/fields/relation-field.js(1,1): error TS9005: Declaration emit for this file requires using private name '_RelationField.TargetModel'. An explicit type annotation may unblock declaration emit.   
packages\core\database\src\mock-database.ts(11,10): error TS2305: Module '"../lib"' has no exported member 'Database'.
packages\core\database\src\mock-database.ts(11,20): error TS2305: Module '"../lib"' has no exported member 'IDatabaseOptions'.
packages\core\database\src\relation-repository\types.ts(10,10): error TS2305: Module '"../../lib"' has no exported member 'AssociationKeysToBeUpdate'.
packages\core\database\src\relation-repository\types.ts(10,37): error TS2305: Module '"../../lib"' has no exported member 'BlackList'.
packages\core\database\src\relation-repository\types.ts(10,48): error TS2305: Module '"../../lib"' has no exported member 'Values'.
packages\core\database\src\relation-repository\types.ts(10,56): error TS2305: Module '"../../lib"' has no exported member 'WhiteList'.
TypeScript: 6 semantic errors
TypeScript: 17 declaration errors
TypeScript: -10 emit errors
TypeScript: emit succeeded (with errors)
E:\code\tongdaCode\nocobase\node_modules\gulp-typescript\release\output.js:131     
            this.streamFull.emit('error', new Error("TypeScript: Compilation failed"));
                                          ^

Error: TypeScript: Compilation failed
    at Output.mightFinish (E:\code\tongdaCode\nocobase\node_modules\gulp-typescript\release\output.js:131:43)
    at E:\code\tongdaCode\nocobase\node_modules\gulp-typescript\release\output.js:66:22
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on CompileStream instance at:
    at E:\code\tongdaCode\nocobase\node_modules\gulp-typescript\release\output.js:117:29
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.19.3
E:\code\tongdaCode\nocobase\node_modules\execa\lib\error.js:60
                error = new Error(message);
                        ^

Error: Command failed with exit code 1: nocobase-build packages/core
    at makeError (E:\code\tongdaCode\nocobase\node_modules\execa\lib\error.js:60:11)
    at handlePromise (E:\code\tongdaCode\nocobase\node_modules\execa\index.js:118:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)  
    at async Command.<anonymous> (E:\code\tongdaCode\nocobase\packages\core\cli\src\commands\build.js:40:7) {
  shortMessage: 'Command failed with exit code 1: nocobase-build packages/core    ',
  command: 'nocobase-build packages/core    ',
  escapedCommand: 'nocobase-build "packages/core" "" "" "" ""',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

Node.js v20.19.3
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
(TraeAI-8) E:\code\tongdaCode\nocobase [1:1] $ 

一样

看报错位置的代码和实际代码不符呢,清理一下缓存试试。

yarn nocobase clean
yarn rimraf -rf node_modules
yarn install
yarn build
1 Like

删除后的确可以了,感谢