提交 c0ca4bf8 编写于 作者: M mehaotian

Merge branch 'dev' of https://github.com/dcloudio/uni-app into dev

......@@ -82,9 +82,9 @@ function processPagesJson (pagesJson, loader = {
})
}
if (Object.keys(uniNVuePages).length) { // 直接挂在 pagesJson 上
if (uniNVuePages.length) { // 直接挂在 pagesJson 上
pagesJson.nvue = {
pages: uniNVuePages
pages: uniNVuePages.reverse()
}
if (uniNVueEntryPagePath) {
pagesJson.nvue.entryPagePath = uniNVueEntryPagePath
......@@ -152,9 +152,10 @@ function isValidPage (page, root = '') {
// process.UNI_NVUE_ENTRY[pagePath] = path.resolve(process.env.UNI_INPUT_DIR, pagePath + '.nvue') + '?entry'
// }
uniNVuePages[pagePath + '.html'] = {
'window': page.style || {}
}
uniNVuePages.push({
'path': pagePath + '.html',
'style': page.style || {}
})
return false
}
......@@ -176,7 +177,7 @@ function getNVueMainJsPath (page) {
process.UNI_ENTRY = {}
process.UNI_NVUE_ENTRY = {}
let uniNVuePages = {}
const uniNVuePages = []
function parsePages (pagesJson, pageCallback, subPageCallback) {
if (!pagesJson) {
......@@ -215,7 +216,7 @@ function parseEntry (pagesJson) {
process.UNI_NVUE_ENTRY['app-service'] = path.resolve(process.env.UNI_INPUT_DIR, getMainEntry())
}
uniNVuePages = {}
uniNVuePages.length = 0
if (!pagesJson) {
pagesJson = getPagesJson() // 会检测修改 nvue entry
......
......@@ -140,15 +140,21 @@ if (platformOptions.usingComponents === true) {
}
if (
process.env.NODE_ENV === 'production' &&
(process.env.UNI_USING_COMPONENTS || process.env.UNI_PLATFORM === 'h5')
process.env.UNI_USING_COMPONENTS ||
process.env.UNI_PLATFORM === 'h5'
) { // 自定义组件模式或 h5 平台
const uniStatistics = Object.assign(
manifestJsonObj.uniStatistics || {},
platformOptions.uniStatistics || {}
)
if (uniStatistics.enable !== false) {
if (
uniStatistics.enable !== false &&
(
process.env.NODE_ENV === 'production' ||
uniStatistics.enable === 'development'
)
) {
if (process.UNI_STAT_CONFIG.appid) {
process.env.UNI_USING_STAT = true
} else {
......@@ -204,10 +210,10 @@ if (process.env.UNI_PLATFORM !== 'h5') {
const moduleAlias = require('module-alias')
// 将 template-compiler 指向修订后的版本
// 将 template-compiler 指向修订后的版本
moduleAlias.addAlias('vue-template-compiler', '@dcloudio/vue-cli-plugin-uni/packages/vue-template-compiler')
moduleAlias.addAlias('@megalo/template-compiler', '@dcloudio/vue-cli-plugin-uni/packages/@megalo/template-compiler')
moduleAlias.addAlias('mpvue-template-compiler', '@dcloudio/vue-cli-plugin-uni/packages/mpvue-template-compiler')
moduleAlias.addAlias('mpvue-template-compiler', '@dcloudio/vue-cli-plugin-uni/packages/mpvue-template-compiler')
if (runByHBuilderX) {
const oldError = console.error
......
......@@ -128,12 +128,14 @@ module.exports = function (pagesJson, userManifestJson) {
const nvuePages = pagesJson.nvue && pagesJson.nvue.pages
const nvuePagePaths = Object.keys(nvuePages || {})
if (nvuePagePaths.length) {
if (nvuePages.length) {
const pages = {}
nvuePagePaths.forEach(nvuePagePath => {
pages[nvuePagePath] = {
'window': parseStyle(pagesJson.nvue.pages[nvuePagePath]['window'] || {}),
nvuePages.forEach(({
path,
style
}) => {
pages[path] = {
'window': parseStyle(style),
'nvue': true
}
})
......@@ -319,7 +321,7 @@ module.exports = function (pagesJson, userManifestJson) {
// networkTimeout
normalizeNetworkTimeout(appJson)
appJson.page = Object.create(null)
appJson.pages = Object.keys(appJson.nvue.pages).reverse().map(pagePath => {
appJson.pages = Object.keys(appJson.nvue.pages).map(pagePath => {
const newPagePath = pagePath.replace('.html', '')
appJson.page[newPagePath] = {
window: appJson.nvue.pages[pagePath].window,
......
......@@ -44,7 +44,9 @@ const pagesJson2AppJson = {
fromJson &&
fromJson.nvue &&
fromJson.nvue.pages &&
fromJson.nvue.pages[page.pagePath + '.html']
fromJson.nvue.pages.find(({
path
}) => path === (page.pagePath + '.html'))
)
) {
console.error(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册