Anka 配置

AnkaCLI 的默认配置如下所示。如果需要自定义配置,则在项目根目录下添加 anka.config.jsanka.config.json 文件。

  1. /* anka.config.js */
  2. module.exports = {
  3. "components": "./components",
  4. "pages": "./pages"
  5. }

详细配置

  1. /*****************************************************
  2. * Danger zone
  3. *****************************************************/
  4. /**
  5. * The path where WeChat miniprogram source files exist.
  6. * @default './src'
  7. */
  8. export const sourceDir = './src'
  9. /**
  10. * The path where WeChat miniprogram compiled files exist.
  11. * @default './dist'
  12. */
  13. export const outputDir = './dist'
  14. /**
  15. * The path where WeChat miniprogram pages exist.
  16. * @default './src/pages'
  17. */
  18. export const pages = './pages'
  19. /**
  20. * The path where WeChat miniprogram components exist.
  21. * @default './src/components'
  22. */
  23. export const components = './components'
  24. /**
  25. * Template for creating page and component.
  26. */
  27. export const template = {
  28. page: path.join(__dirname, '../template/page'),
  29. component: path.join(__dirname, '../template/component')
  30. }
  31. /**
  32. * The path where WeChat miniprogram subpackages exist.
  33. * @default './src/subPackages'
  34. */
  35. export const subPackages = './subPackages'
  36. /*****************************************************
  37. * Custom configure
  38. *****************************************************/
  39. /**
  40. * Whether to output compile information.
  41. * @default false
  42. */
  43. export const quiet = false
  44. /**
  45. * Anka development mode.
  46. * @default false
  47. */
  48. export const devMode = false
  49. /**
  50. * Register file parser.
  51. */
  52. export const parsers: ParsersConfigration = [
  53. {
  54. match: /.*\.(js|es)$/,
  55. parsers: [
  56. {
  57. parser: babelParser,
  58. options: {}
  59. }
  60. ]
  61. },
  62. {
  63. match: /.*\.(wxss|css|postcss)$/,
  64. parsers: [
  65. {
  66. parser: styleParser,
  67. options: {}
  68. }
  69. ]
  70. },
  71. {
  72. match: /.*\.(sass|scss)$/,
  73. parsers: [
  74. {
  75. parser: sassParser,
  76. options: {}
  77. }
  78. ]
  79. },
  80. {
  81. match: /.*\.(ts|typescript)$/,
  82. parsers: [
  83. {
  84. parser: typescriptParser,
  85. options: {}
  86. }
  87. ]
  88. }
  89. ]
  90. /**
  91. * Whether to output debug information.
  92. * @default false
  93. */
  94. export const debug: boolean = false
  95. /**
  96. * Register plugin.
  97. */
  98. export const plugins: PluginsConfigration = [
  99. {
  100. plugin: extractDependencyPlugin,
  101. options: {}
  102. },
  103. {
  104. plugin: saveFilePlugin,
  105. options: {}
  106. }
  107. ]
  108. /**
  109. * Files that will be ignored in compilation.
  110. */
  111. export const ignored: IgnoredConfigration = []
  112. /*****************************************************
  113. * experimental configure
  114. *****************************************************/