You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.wxgame.ts 2.4KB

5 年之前
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. // 使用 EUI 项目,要压缩皮肤文件,可以开启这个压缩配置
  36. // {
  37. // sources: ["resource/default.thm.js"],
  38. // target: "default.thm.min.js"
  39. // },
  40. {
  41. sources: ["main.js"],
  42. target: "main.min.js"
  43. }
  44. ]),
  45. new ManifestPlugin({ output: 'manifest.js', useWxPlugin: useWxPlugin })
  46. ]
  47. }
  48. }
  49. else {
  50. throw `unknown command : ${params.command}`;
  51. }
  52. },
  53. mergeSelector: defaultConfig.mergeSelector,
  54. typeSelector: defaultConfig.typeSelector
  55. }
  56. export = config;