Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

63 Zeilen
2.2KB

  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 { WxgamePlugin } from './wxgame/wxgame';
  6. import { CustomPlugin } from './myplugin';
  7. import * as defaultConfig from './config';
  8. //是否使用微信分离插件
  9. const useWxPlugin:boolean = false;
  10. const config: ResourceManagerConfig = {
  11. buildConfig: (params) => {
  12. const { target, command, projectName, version } = params;
  13. const outputDir = `../${projectName}_wxgame`;
  14. if (command == 'build') {
  15. return {
  16. outputDir,
  17. commands: [
  18. new CleanPlugin({ matchers: ["js", "resource", "egret-library"] }),
  19. new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
  20. new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
  21. new WxgamePlugin(useWxPlugin),
  22. new ManifestPlugin({ output: 'manifest.js' })
  23. ]
  24. }
  25. }
  26. else if (command == 'publish') {
  27. return {
  28. outputDir,
  29. commands: [
  30. new CleanPlugin({ matchers: ["js", "resource", "egret-library"] }),
  31. new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
  32. new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
  33. new WxgamePlugin(useWxPlugin),
  34. new UglifyPlugin([{
  35. sources: ["resource/default.thm.js"],
  36. target: "default.thm.min.js"
  37. }, {
  38. sources: ["main.js"],
  39. target: "main.min.js"
  40. }
  41. ]),
  42. new ManifestPlugin({ output: 'manifest.js', useWxPlugin: useWxPlugin })
  43. ]
  44. }
  45. }
  46. else {
  47. throw `unknown command : ${params.command}`;
  48. }
  49. },
  50. mergeSelector: defaultConfig.mergeSelector,
  51. typeSelector: defaultConfig.typeSelector
  52. }
  53. export = config;