Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

5 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 { MygamePlugin } from './mygame/mygame';
  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}_mygame`;
  12. if (command == 'build') {
  13. return {
  14. outputDir,
  15. commands: [
  16. new CleanPlugin({ matchers: ["js", "resource"] }),
  17. new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
  18. new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
  19. new MygamePlugin(),
  20. new ManifestPlugin({ output: 'manifest.js' })
  21. ]
  22. }
  23. }
  24. else if (command == 'publish') {
  25. return {
  26. outputDir,
  27. commands: [
  28. new CleanPlugin({ matchers: ["js", "resource"] }),
  29. new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
  30. new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
  31. new MygamePlugin(),
  32. new UglifyPlugin([
  33. // 使用 EUI 项目,要压缩皮肤文件,可以开启这个压缩配置
  34. // {
  35. // sources: ["resource/default.thm.js"],
  36. // target: "default.thm.min.js"
  37. // },
  38. {
  39. sources: ["main.js"],
  40. target: "main.min.js"
  41. }
  42. ]),
  43. new ManifestPlugin({ output: 'manifest.js' })
  44. ]
  45. }
  46. }
  47. else {
  48. throw `unknown command : ${params.command}`;
  49. }
  50. },
  51. mergeSelector: defaultConfig.mergeSelector,
  52. typeSelector: defaultConfig.typeSelector
  53. }
  54. export = config;