You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.1 KiB
30 lines
1.1 KiB
|
1 week ago
|
import type { BuildPlugin } from '../node_modules/@cocos/creator-types/editor/packages/builder/@types/public/build-plugin';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 构建入口:供主进程/渲染进程加载 configs、注册构建面板选项。
|
||
|
|
* hooks 实现见 build-hooks.ts(构建 worker 执行);同时在此 re-export,避免编辑器校验报「未找到 custom-builder.onBeforeBuild」。
|
||
|
|
*/
|
||
|
|
export { throwError, onBeforeBuild, onAfterBuild } from './build-hooks';
|
||
|
|
|
||
|
|
export const configs: BuildPlugin.Configs = {
|
||
|
|
'*': {
|
||
|
|
hooks: './build-hooks',
|
||
|
|
options: {
|
||
|
|
stripConsole: {
|
||
|
|
label: '构建时移除 console 打印',
|
||
|
|
description:
|
||
|
|
'勾选后遍历本次构建输出目录内所有 .js,移除 console.* 与 debugger(需发布干净包时开启;调试构建请勿勾选)',
|
||
|
|
default: false,
|
||
|
|
render: {
|
||
|
|
ui: 'ui-checkbox',
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
export function load() {
|
||
|
|
console.log('[tools] custom builder loaded (configs only; hooks run from build-hooks in build worker)');
|
||
|
|
return true;
|
||
|
|
}
|