config.ios.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 * as defaultConfig from './config';
  6. const config: ResourceManagerConfig = {
  7. buildConfig: (params) => {
  8. const { target, command, projectName, version } = params;
  9. const outputDir = `../${projectName}_ios/assets/game`;
  10. if (command == 'build') {
  11. return {
  12. outputDir,
  13. commands: [
  14. new CleanPlugin({ matchers: ["js", "resource"] }),
  15. new CompilePlugin({ libraryType: "debug", defines: { DEBUG: true, RELEASE: false } }),
  16. new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
  17. new ManifestPlugin({ output: 'manifest.json' })
  18. ]
  19. }
  20. }
  21. else if (command == 'publish') {
  22. return {
  23. outputDir,
  24. commands: [
  25. new CleanPlugin({ matchers: ["js", "resource"] }),
  26. new CompilePlugin({ libraryType: "release", defines: { DEBUG: false, RELEASE: true } }),
  27. new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
  28. new UglifyPlugin([{
  29. sources: ["main.js"],
  30. target: "main.min.js"
  31. }
  32. ]),
  33. new ManifestPlugin({ output: 'manifest.json' })
  34. ]
  35. }
  36. }
  37. else {
  38. throw `unknown command : ${params.command}`;
  39. }
  40. },
  41. mergeSelector: defaultConfig.mergeSelector,
  42. typeSelector: defaultConfig.typeSelector
  43. }
  44. export = config;