index.ts 1.3 KB
Newer Older
fxy060608's avatar
fxy060608 已提交
1 2 3 4 5 6
import {
  initAppProvide,
  uniHBuilderXConsolePlugin,
  uniViteInjectPlugin,
  UNI_EASYCOM_EXCLUDE,
} from '@dcloudio/uni-cli-shared'
fxy060608's avatar
fxy060608 已提交
7

fxy060608's avatar
fxy060608 已提交
8
import { uniEasycomPlugin } from '../plugins/easycom'
fxy060608's avatar
fxy060608 已提交
9
import { uniManifestJsonPlugin } from '../plugins/manifestJson'
fxy060608's avatar
fxy060608 已提交
10
import { uniStatsPlugin } from '../plugins/stats'
fxy060608's avatar
fxy060608 已提交
11
import { uniTemplatePlugin } from '../plugins/template'
fxy060608's avatar
fxy060608 已提交
12
import { uniAppNVuePlugin } from './plugin'
fxy060608's avatar
fxy060608 已提交
13
import { uniAppCssPlugin } from './plugins/appCss'
fxy060608's avatar
fxy060608 已提交
14
import { uniEsbuildPlugin } from './plugins/esbuild'
fxy060608's avatar
fxy060608 已提交
15 16
import { uniMainJsPlugin } from './plugins/mainJs'
import { uniPagesJsonPlugin } from './plugins/pagesJson'
fxy060608's avatar
fxy060608 已提交
17

fxy060608's avatar
fxy060608 已提交
18 19
export { initNVueNodeTransforms } from './plugin'

fxy060608's avatar
fxy060608 已提交
20
export function initNVuePlugins() {
fxy060608's avatar
fxy060608 已提交
21
  const renderer = process.env.UNI_RENDERER
fxy060608's avatar
fxy060608 已提交
22
  const appService = process.env.UNI_RENDERER_NATIVE === 'appService'
fxy060608's avatar
fxy060608 已提交
23
  return [
fxy060608's avatar
fxy060608 已提交
24
    uniAppCssPlugin(),
fxy060608's avatar
fxy060608 已提交
25 26
    uniEasycomPlugin({ exclude: UNI_EASYCOM_EXCLUDE }),
    uniHBuilderXConsolePlugin(),
fxy060608's avatar
fxy060608 已提交
27 28 29
    uniMainJsPlugin({ renderer, appService }),
    uniManifestJsonPlugin(),
    uniPagesJsonPlugin({ renderer, appService }),
fxy060608's avatar
fxy060608 已提交
30
    uniViteInjectPlugin('uni:app-inject', initAppProvide()),
fxy060608's avatar
fxy060608 已提交
31 32
    uniAppNVuePlugin({ appService }),
    uniEsbuildPlugin({ renderer, appService }),
fxy060608's avatar
fxy060608 已提交
33
    ...(appService ? [uniStatsPlugin(), uniTemplatePlugin({ renderer })] : []),
fxy060608's avatar
fxy060608 已提交
34
  ]
fxy060608's avatar
fxy060608 已提交
35
}