提交 05a38735 编写于 作者: fxy060608's avatar fxy060608

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

......@@ -30,7 +30,7 @@ module.exports = {
}
if (PLATFORMS.indexOf(scriptOptions.env.UNI_PLATFORM) === -1) {
console.error(`UNI_PLATFORM 支持下平台 ${JSON.stringify(PLATFORMS)}`)
console.error(`UNI_PLATFORM 支持下平台 ${JSON.stringify(PLATFORMS)}`)
process.exit(0)
}
......@@ -41,4 +41,4 @@ module.exports = {
return scriptOptions
}
}
}
......@@ -36,7 +36,11 @@ const uniPath = process.env.UNI_USING_V8
? '../packages/uni-app-plus-nvue-v8/dist/index.js'
: '../packages/uni-app-plus-nvue/dist/index.js'
const provide = {}
const uniCloudPath = require.resolve('@dcloudio/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js')
const provide = {
'uniCloud': [uniCloudPath, 'default']
}
if (process.env.UNI_USING_V3 || process.env.UNI_USING_NATIVE) {
provide['uni.getCurrentSubNVue'] = [path.resolve(__dirname,
......@@ -68,7 +72,8 @@ const plugins = [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'VUE_APP_PLATFORM': JSON.stringify(process.env.UNI_PLATFORM)
'VUE_APP_PLATFORM': JSON.stringify(process.env.UNI_PLATFORM),
'UNI_CLOUD_PROVIDER': process.env.UNI_CLOUD_PROVIDER
}
}),
new webpack.BannerPlugin({
......
......@@ -64,6 +64,9 @@ function getWebpackConfig (api, args, options) {
})
} else {
modifyConfig(webpackConfig, config => {
if (!config.optimization) {
config.optimization = {}
}
config.optimization.namedModules = false
})
}
......@@ -77,11 +80,11 @@ function getWebpackConfigs (api, args, options) {
const pluginOptions = (options.pluginOptions || (options.pluginOptions = {}))
pluginOptions['uni-app-plus'] = {
service: true
}
}
options.publicPath = '/'
const serviceWebpackConfig = getWebpackConfig(api, args, options)
delete pluginOptions['uni-app-plus']['service']
pluginOptions['uni-app-plus']['view'] = true
pluginOptions['uni-app-plus']['view'] = true
options.publicPath = './'
const viewWebpackConfig = getWebpackConfig(api, args, options)
return [serviceWebpackConfig, viewWebpackConfig]
......
......@@ -24,6 +24,7 @@ const {
const runtimePath = '@dcloudio/uni-mp-weixin/dist/mp.js'
const wxsPath = '@dcloudio/uni-mp-weixin/dist/wxs.js'
const uniCloudPath = path.resolve(__dirname, '../../packages/uni-cloud/dist/index.js')
function getProvides (isAppService) {
if (isAppService) {
......@@ -35,7 +36,8 @@ function getProvides (isAppService) {
'Component': [runtimePath, 'Component'],
'Behavior': [runtimePath, 'Behavior'],
'getDate': [wxsPath, 'getDate'],
'getRegExp': [wxsPath, 'getRegExp']
'getRegExp': [wxsPath, 'getRegExp'],
'uniCloud': [uniCloudPath, 'default']
}
}
return { // app-view
......
......@@ -94,7 +94,8 @@ module.exports = function chainWebpack (platformOptions, vueOptions, api) {
webpackConfig
.plugin('uni-define')
.use(require.resolve('webpack/lib/DefinePlugin'), [{
'process.env.UNI_ENV': JSON.stringify(process.env.UNI_PLATFORM)
'process.env.UNI_ENV': JSON.stringify(process.env.UNI_PLATFORM),
'process.env.UNI_CLOUD_PROVIDER': process.env.UNI_CLOUD_PROVIDER
}])
if (runByHBuilderX) { // 由 HBuilderX 运行时,移除进度,错误
......
......@@ -3,6 +3,30 @@ const path = require('path')
const mkdirp = require('mkdirp')
const loaderUtils = require('loader-utils')
process.env.UNI_CLOUD_PROVIDER = JSON.stringify({})
if (process.env.UNI_CLOUD_SPACES) {
try {
const spaces = JSON.parse(process.env.UNI_CLOUD_SPACES)
if (Array.isArray(spaces) && spaces.length === 1) {
const space = spaces[0]
if (space.clientSecret) {
process.env.UNI_CLOUD_PROVIDER = JSON.stringify({
provider: 'aliyun',
spaceId: space.name,
clientSecret: space.clientSecret,
endpoint: space.apiEndpoint
})
} else {
process.env.UNI_CLOUD_PROVIDER = JSON.stringify({
provider: 'tencent',
spaceId: space.name
})
}
}
} catch (e) {}
}
if (process.env.UNI_PLATFORM === 'mp-360') {
process.env.UNI_PLATFORM = 'h5'
process.env.UNI_SUB_PLATFORM = 'mp-360'
......
......@@ -30,9 +30,11 @@ const {
const runtimePath = '@dcloudio/uni-mp-weixin/dist/mp.js'
const wxsPath = '@dcloudio/uni-mp-weixin/dist/wxs.js'
const uniCloudPath = path.resolve(__dirname, '../../packages/uni-cloud/dist/index.js')
function getProvides () {
return {
'uniCloud': [uniCloudPath, 'default'],
'wx.nextTick': [runtimePath, 'nextTick'],
'Page': [runtimePath, 'Page'],
'Component': [runtimePath, 'Component'],
......@@ -103,7 +105,7 @@ module.exports = {
`import 'uni-pages';import 'uni-${process.env.UNI_PLATFORM}';`
const qihooCode = process.env.UNI_SUB_PLATFORM === 'mp-360'
? `
? `
import 'uni-touch-emulator';
import qh from 'uni-qh';
global.qh = qh;
......@@ -117,7 +119,7 @@ global.onAppShow = function(){};
alias: {
'vue-router': resolve('packages/h5-vue-router'),
'uni-h5': require.resolve('@dcloudio/uni-h5'),
'uni-qh': path.resolve(__dirname, 'qh-api.js'),
'uni-qh': path.resolve(__dirname, 'qh-api.js'),
'uni-touch-emulator': path.resolve(__dirname, 'touch-emulator.js')
}
},
......
......@@ -27,8 +27,10 @@ function createUniMPPlugin () {
function getProvides () {
const uniPath = require.resolve('@dcloudio/uni-' + process.env.UNI_PLATFORM)
const uniCloudPath = path.resolve(__dirname, '../packages/uni-cloud/dist/index.js')
const provides = {
'uni': [uniPath, 'default']
'uni': [uniPath, 'default'],
'uniCloud': [uniCloudPath, 'default']
}
if (process.env.UNI_USING_COMPONENTS) {
......
......@@ -24,7 +24,7 @@ function getTabBarPages (appJson) {
}
function isTabBarPage (pathName, tabBarPages) {
return tabBarPages && tabBarPages.find(item => item.pagePath === pathName)
return Array.isArray(tabBarPages) && tabBarPages.find(item => item.pagePath === pathName)
}
function parseEntryPagePath (appJson, manifestJson) {
......@@ -89,7 +89,7 @@ module.exports = function (appJson, manifestJson, {
path: entryPagePath + '.js' + (appJson.entryPageQuery || '')
}
const tabBar = manifestJson.plus.tabBar
if (isTabBarPage(entryPagePath, tabBar.list)) {
if (tabBar && isTabBarPage(entryPagePath, tabBar.list)) {
tabBar.child = ['lauchwebview']
}
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册