提交 c0ca4bf8 编写于 作者: M mehaotian

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

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