copy.ts 708 字节
Newer Older
fxy060608's avatar
fxy060608 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
import path from 'path'
import slash from 'slash'

import { uniViteCopyPlugin } from '@dcloudio/uni-cli-shared'

export function uniCopyPlugin() {
  return uniViteCopyPlugin({
    targets: [
      {
        src: slash(path.resolve(__dirname, '../../lib/template/')),
        dest: process.env.UNI_OUTPUT_DIR,
      },
      {
        src: slash(require.resolve('@dcloudio/uni-app-plus/dist/style.css')),
        dest: process.env.UNI_OUTPUT_DIR,
      },
      {
        src: slash(
          require.resolve('@dcloudio/uni-app-plus/dist/uni-app-view.umd.js')
        ),
        dest: process.env.UNI_OUTPUT_DIR,
      },
    ],
    hook: 'writeBundle',
    verbose: process.env.DEBUG ? true : false,
  })
}