Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

66 lines
2.5KB

  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 { QQgamePlugin } from './qqgame/qqgame';
  6. import { CustomPlugin } from './myplugin';
  7. import * as defaultConfig from './config';
  8. //是否使用QQ小游戏引擎插件
  9. const useQQPlugin: boolean = false;
  10. let pluginList: string[] = []
  11. const config: ResourceManagerConfig = {
  12. buildConfig: (params) => {
  13. const { target, command, projectName, version } = params;
  14. const outputDir = `../${projectName}_qqgame`;
  15. if (command == 'build') {
  16. return {
  17. outputDir,
  18. commands: [
  19. new CleanPlugin({ matchers: ["js", "resource"] }),
  20. new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
  21. new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
  22. new QQgamePlugin(useQQPlugin, pluginList),
  23. new ManifestPlugin({ output: 'manifest.js', qqPlugin: { use: useQQPlugin, pluginList: pluginList } })
  24. ]
  25. }
  26. }
  27. else if (command == 'publish') {
  28. return {
  29. outputDir,
  30. commands: [
  31. new CleanPlugin({ matchers: ["js", "resource"] }),
  32. new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
  33. new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
  34. new QQgamePlugin(useQQPlugin, pluginList),
  35. new UglifyPlugin([
  36. // 使用 EUI 项目,要压缩皮肤文件,可以开启这个压缩配置
  37. // {
  38. // sources: ["resource/default.thm.js"],
  39. // target: "default.thm.min.js"
  40. // },
  41. {
  42. sources: ["main.js"],
  43. target: "main.min.js"
  44. }
  45. ]),
  46. new ManifestPlugin({ output: 'manifest.js', qqPlugin: { use: useQQPlugin, pluginList: pluginList } })
  47. ]
  48. }
  49. }
  50. else {
  51. throw `unknown command : ${params.command}`;
  52. }
  53. },
  54. mergeSelector: defaultConfig.mergeSelector,
  55. typeSelector: defaultConfig.typeSelector
  56. }
  57. export = config;