diff --git a/packages/uni-cli-shared/lib/manifest.js b/packages/uni-cli-shared/lib/manifest.js index 535d0ea07918c7bdf15bcde9de44111dd414f0f5..296416fddb58d26f05e7ec8e030da2c78403ca98 100644 --- a/packages/uni-cli-shared/lib/manifest.js +++ b/packages/uni-cli-shared/lib/manifest.js @@ -50,11 +50,7 @@ function getH5Options (manifestJson) { h5.title = h5.title || manifestJson.name || '' - if (process.env.UNI_SUB_PLATFORM === 'mp-360') { // 360 小程序仅支持 hash 模式 - h5.router = Object.assign({}, defaultRouter) - } else { - h5.router = Object.assign({}, defaultRouter, h5.router || {}) - } + h5.router = Object.assign({}, defaultRouter, h5.router || {}) h5['async'] = Object.assign({}, defaultAsync, h5['async'] || {}) @@ -79,11 +75,6 @@ function getH5Options (manifestJson) { h5.publicPath = base } - if (process.env.UNI_SUB_PLATFORM === 'mp-360') { - h5.router.base = '/' - h5.publicPath = '/' - } - /* eslint-disable no-mixed-operators */ h5.template = h5.template && path.resolve(process.env.UNI_INPUT_DIR, h5.template) || path.resolve(__dirname, '../../../../public/index.html') diff --git a/packages/uni-cli-shared/lib/platform.js b/packages/uni-cli-shared/lib/platform.js index 6b0da7dad18207e3df3cc2ff6e36d8d6acce0e86..b79fbd4cfef515bc21f7e494c55737532abec51a 100644 --- a/packages/uni-cli-shared/lib/platform.js +++ b/packages/uni-cli-shared/lib/platform.js @@ -340,10 +340,6 @@ const PLATFORMS = { } } // 解决 vue-cli-service lint 时 UNI_PLATFORM 不存在 -if (process.env.UNI_PLATFORM === 'mp-360') { - process.env.UNI_PLATFORM = 'h5' - process.env.UNI_SUB_PLATFORM = 'mp-360' -} process.env.UNI_PLATFORM = process.env.UNI_PLATFORM || 'h5' const platform = PLATFORMS[process.env.UNI_PLATFORM] @@ -379,14 +375,6 @@ if (process.env.UNI_PLATFORM.indexOf('app-') === 0) { preprocessContext['APP'] = true } -preprocessContext['MP-360'] = false -preprocessContext['MP_360'] = false -if (process.env.UNI_SUB_PLATFORM === 'mp-360') { - preprocessContext['H5'] = false - preprocessContext['MP-360'] = true - preprocessContext['MP_360'] = true -} - if (process.UNI_SCRIPT_DEFINE && Object.keys(process.UNI_SCRIPT_DEFINE).length) { Object.keys(process.UNI_SCRIPT_DEFINE).forEach(name => { preprocessContext[name] = process.UNI_SCRIPT_DEFINE[name] @@ -579,7 +567,7 @@ module.exports = { mergeLonghand: false, mergeRules: false, cssDeclarationSorter: false, - uniqueSelectors: false, // 标签排序影响头条小程序 + uniqueSelectors: false, // 标签排序影响头条小程序 minifySelectors: false, // 标签排序影响头条小程序 discardComments: false, discardDuplicates: false // 条件编译会导致重复 @@ -612,4 +600,4 @@ module.exports = { ] } } -} +} diff --git a/packages/vue-cli-plugin-uni/generator.js b/packages/vue-cli-plugin-uni/generator.js index adec6683d1b31b2907095559396d4ead6471d835..a8b31458fe5a6a98a01f4acf5f675ffb8ac6925a 100644 --- a/packages/vue-cli-plugin-uni/generator.js +++ b/packages/vue-cli-plugin-uni/generator.js @@ -14,15 +14,13 @@ module.exports = (api, options, rootOptions) => { 'dev:mp-weixin': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch', 'dev:mp-baidu': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch', 'dev:mp-alipay': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch', - 'dev:mp-toutiao': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch', - 'dev:mp-360': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-360 vue-cli-service uni-build --watch', + 'dev:mp-toutiao': 'cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch', 'build:h5': 'cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build', 'build:mp-qq': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build', 'build:mp-weixin': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build', 'build:mp-baidu': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build', 'build:mp-alipay': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build', - 'build:mp-toutiao': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build', - 'build:mp-360': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-360 vue-cli-service uni-build', + 'build:mp-toutiao': 'cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build', 'dev:custom': 'cross-env NODE_ENV=development uniapp-cli custom', 'build:custom': 'cross-env NODE_ENV=production uniapp-cli custom' }, @@ -42,7 +40,7 @@ module.exports = (api, options, rootOptions) => { 'vuex': '^3.0.1' }, devDependencies: { - '@dcloudio/uni-cli-shared': version, + '@dcloudio/uni-cli-shared': version, '@dcloudio/uni-migration': version, '@dcloudio/uni-template-compiler': version, '@dcloudio/vue-cli-plugin-hbuilderx': version, @@ -58,4 +56,4 @@ module.exports = (api, options, rootOptions) => { ] } }) -} +} diff --git a/packages/vue-cli-plugin-uni/lib/env.js b/packages/vue-cli-plugin-uni/lib/env.js index 2fd28fe77aa9294e8fea61bd0dcae3bf8933f502..f940e84c0c57a95b3fe7cd0692453f845407dfec 100644 --- a/packages/vue-cli-plugin-uni/lib/env.js +++ b/packages/vue-cli-plugin-uni/lib/env.js @@ -18,27 +18,27 @@ if (process.env.UNI_CLOUD_SPACES) { if (spaces.length === 1) { const space = spaces[0] console.log(`本项目的uniCloud使用的默认服务空间spaceId为:${space.id}`) - } - process.env.UNI_CLOUD_PROVIDER = JSON.stringify(spaces.map(space => { - if (space.clientSecret) { - return { - provider: 'aliyun', - spaceName: space.name, - spaceId: space.id, - clientSecret: space.clientSecret, - endpoint: space.apiEndpoint - } - } else { - return { - provider: 'tencent', - spaceName: space.name, - spaceId: space.id - } - } + } + process.env.UNI_CLOUD_PROVIDER = JSON.stringify(spaces.map(space => { + if (space.clientSecret) { + return { + provider: 'aliyun', + spaceName: space.name, + spaceId: space.id, + clientSecret: space.clientSecret, + endpoint: space.apiEndpoint + } + } else { + return { + provider: 'tencent', + spaceName: space.name, + spaceId: space.id + } + } })) } } catch (e) {} -} +} if ( process.UNI_CLOUD && @@ -48,11 +48,6 @@ if ( console.warn(`发布H5,需要在uniCloud后台操作,绑定安全域名,否则会因为跨域问题而无法访问。教程参考:https://uniapp.dcloud.io/uniCloud/quickstart-H5`) } -if (process.env.UNI_PLATFORM === 'mp-360') { - process.env.UNI_PLATFORM = 'h5' - process.env.UNI_SUB_PLATFORM = 'mp-360' -} - // 初始化环境变量 const defaultInputDir = '../../../../src' const defaultOutputDir = '../../../../dist/' + @@ -71,11 +66,6 @@ process.env.VUE_APP_PLATFORM = process.env.UNI_PLATFORM process.env.UNI_INPUT_DIR = process.env.UNI_INPUT_DIR || path.resolve(__dirname, defaultInputDir) process.env.UNI_OUTPUT_DIR = process.env.UNI_OUTPUT_DIR || path.resolve(__dirname, defaultOutputDir) -if (process.env.UNI_SUB_PLATFORM === 'mp-360') { - const outputDir = process.env.UNI_OUTPUT_DIR - process.env.UNI_OUTPUT_DIR = path.resolve(outputDir.substr(0, outputDir.lastIndexOf('h5')), 'mp-360/dist') -} - if (process.env.UNI_PLATFORM === 'app-plus') { process.env.UNI_OUTPUT_TMP_DIR = path.resolve(process.env.UNI_OUTPUT_DIR, '../.tmp/app-plus') } @@ -88,7 +78,7 @@ if (process.env.NODE_ENV === 'production') { // 发行模式,不启用 cache delete process.env.UNI_USING_CACHE } -const { +const { normalizePath, isSupportSubPackages, runByHBuilderX, @@ -212,7 +202,7 @@ if (process.env.UNI_PLATFORM === 'app-plus') { normalizePath(path.resolve(process.env.UNI_INPUT_DIR, filepath)) ) } - } + } } else { // 其他平台,待确认配置方案 if ( manifestJsonObj['app-plus'] && @@ -397,4 +387,4 @@ runByHBuilderX && console.log(`正在编译中...`) module.exports = { manifestPlatformOptions: platformOptions -} +} diff --git a/packages/vue-cli-plugin-uni/lib/h5/index.js b/packages/vue-cli-plugin-uni/lib/h5/index.js index a00b7d3edc562798918617d2c663215792fbe6d3..85e94e4d8a5c4fe490c9f831c35d48ab6bd95bd4 100644 --- a/packages/vue-cli-plugin-uni/lib/h5/index.js +++ b/packages/vue-cli-plugin-uni/lib/h5/index.js @@ -104,14 +104,6 @@ module.exports = { const beforeCode = (useBuiltIns === 'entry' ? `import '@babel/polyfill';` : '') + `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; -global.onAppShow = function(){}; -` : '' - return { devtool: process.env.NODE_ENV === 'production' ? false : 'cheap-module-eval-source-map', resolve: { @@ -130,7 +122,7 @@ global.onAppShow = function(){}; loader: 'wrap-loader', options: { before: [ - qihooCode + beforeCode + statCode + getGlobalUsingComponentsCode() + beforeCode + statCode + getGlobalUsingComponentsCode() ] } }] @@ -186,4 +178,4 @@ global.onAppShow = function(){}; require('./cssnano-options')(webpackConfig) } } -} +} diff --git a/packages/webpack-uni-pages-loader/lib/platforms/h5.js b/packages/webpack-uni-pages-loader/lib/platforms/h5.js index 8e4a736548b8b4b7f4ca4ff9b49c0d029cedfe7d..e584a6315bfb3d9bd33354c31a6deaea217d2a8b 100644 --- a/packages/webpack-uni-pages-loader/lib/platforms/h5.js +++ b/packages/webpack-uni-pages-loader/lib/platforms/h5.js @@ -66,10 +66,6 @@ const getPageComponents = function (inputDir, pagesJson) { globalStyle['h5'] || {} ) - if (process.env.UNI_SUB_PLATFORM === 'mp-360') { - Object.assign(globalStyle, globalStyle['mp-360'] || {}) - } - process.UNI_H5_PAGES_JSON = { pages: {}, globalStyle @@ -94,10 +90,6 @@ const getPageComponents = function (inputDir, pagesJson) { // 解析 titleNView,pullToRefresh const h5Options = Object.assign({}, props['app-plus'] || {}, props['h5'] || {}) - if (process.env.UNI_SUB_PLATFORM === 'mp-360') { - Object.assign(h5Options, props['mp-360'] || {}) - Object.assign(props, props['mp-360'] || {}) - } removePlatformStyle(h5Options) if (h5Options.hasOwnProperty('titleNView')) { @@ -130,7 +122,6 @@ const getPageComponents = function (inputDir, pagesJson) { // 删除 app-plus 平台配置 delete props['app-plus'] delete props['h5'] - delete props['mp-360'] process.UNI_H5_PAGES_JSON.pages[page.path] = props @@ -361,4 +352,4 @@ global.__uniConfig.nvue = ${JSON.stringify({ 'flex-direction': getFlexDirection( ${genRegisterPageVueComponentsCode(pageComponents)} global.__uniRoutes=[${genPageRoutes(pageComponents).concat(genSystemRoutes()).join(',')}] ` -} +}