提交 0838eaee 编写于 作者: fxy060608's avatar fxy060608

feat(cli): add uniCloud

上级 cf3d10d7
......@@ -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,
......
......@@ -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
......
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册