entry-parser.js 494 字节
Newer Older
fxy060608's avatar
fxy060608 已提交
1
const fs = require('fs')
fxy060608's avatar
fxy060608 已提交
2 3 4
const path = require('path')
module.exports = function parseEntry(pages) {
  const entry = {
fxy060608's avatar
fxy060608 已提交
5
    'app': path.resolve(process.env.UNI_INPUT_DIR, 'main.js')
fxy060608's avatar
fxy060608 已提交
6 7
  }
  pages.forEach(page => {
fxy060608's avatar
fxy060608 已提交
8 9 10 11 12 13
    const filepath = path.resolve(process.env.UNI_INPUT_DIR, page.path)
    if (fs.existsSync(filepath + '.nvue')) {
      entry[page.path] = filepath + '.nvue?uxType=page'
    } else {
      entry[page.path] = filepath + '.vue?uxType=page'
    }
fxy060608's avatar
fxy060608 已提交
14 15 16
  })
  return entry
}