parent
a10ebac085
commit
239ebe6cf3
|
@ -4,6 +4,9 @@ import Es from 'esbuild'
|
|||
import { compileScss, parseJs, compileVue, parseHtml } from './compile-vue.js'
|
||||
import { isCustomElement } from './utils.js'
|
||||
|
||||
const IS_WIN = process.platform === 'win32'
|
||||
const PREFIX = IS_WIN ? 'pages\\' : 'pages/'
|
||||
|
||||
function readFile(file) {
|
||||
return (file && fs.cat(file)?.toString()) || ''
|
||||
}
|
||||
|
@ -14,7 +17,9 @@ export default function compile(root = '', dist = '', conf = {}, verbose) {
|
|||
const PUBLIC_DIR = join(root, 'public')
|
||||
const DEPLOY_PATH = conf.base || '' // 部署目录, 默认是根目录部署
|
||||
const IS_MPA = Object.keys(conf.pages).length > 1
|
||||
const PAGES_PREFIX = Object.keys(conf.pages).map(it => `pages/${it}/`)
|
||||
const PAGES_PREFIX = Object.keys(conf.pages).map(it =>
|
||||
IS_WIN ? `${PREFIX + it}\\` : `${PREFIX + it}/`
|
||||
)
|
||||
const INJECT_SCSS = readFile(conf.inject?.scss)
|
||||
const LEGACY_MODE = !!conf.legacy
|
||||
|
||||
|
@ -36,7 +41,7 @@ export default function compile(root = '', dist = '', conf = {}, verbose) {
|
|||
ext: parse(name).ext
|
||||
}
|
||||
if (it.ext !== '') {
|
||||
if (IS_MPA && it.name.startsWith('pages/')) {
|
||||
if (IS_MPA && it.name.startsWith(PREFIX)) {
|
||||
if (PAGES_PREFIX.some(it => it.startsWith(it.name))) {
|
||||
return (list[path] = it)
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue