config.bricks.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /// 阅读 api.d.ts 查看文档
  2. ///<reference path="api.d.ts"/>
  3. import * as path from 'path';
  4. import { UglifyPlugin, CompilePlugin, ManifestPlugin, ExmlPlugin, EmitResConfigFilePlugin, TextureMergerPlugin, CleanPlugin } from 'built-in';
  5. import { BricksPlugin } from './bricks/bricks';
  6. import { CustomPlugin } from './myplugin';
  7. import * as defaultConfig from './config';
  8. const config: ResourceManagerConfig = {
  9. buildConfig: (params) => {
  10. const { target, command, projectName, version } = params;
  11. const outputDir = `../${projectName}_bricks/PublicBrickEngineGame/Res`;
  12. if (command == 'build') {
  13. return {
  14. outputDir,
  15. commands: [
  16. new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
  17. new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
  18. new ManifestPlugin({ output: 'manifest.json' }),
  19. new BricksPlugin()
  20. ]
  21. }
  22. }
  23. else if (command == 'publish') {
  24. console.log('执行publish')
  25. return {
  26. outputDir,
  27. commands: [
  28. new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
  29. new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
  30. new ManifestPlugin({ output: 'manifest.json' }),
  31. new UglifyPlugin([{
  32. sources: ["main.js"],
  33. target: "js/main.min.js"
  34. }
  35. ]),
  36. new BricksPlugin(),
  37. ]
  38. }
  39. } else {
  40. throw `unknown command : ${params.command}`;
  41. }
  42. },
  43. mergeSelector: defaultConfig.mergeSelector,
  44. typeSelector: defaultConfig.typeSelector
  45. }
  46. export = config;