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

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

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