提交 928fbd2e 编写于 作者: S songyu 提交者: 折腾笔记

fix: 独立分包开关名修改

上级 0305a448
...@@ -106,7 +106,7 @@ function updateComponentJson (name, jsonObj, usingComponents = true, type = 'Com ...@@ -106,7 +106,7 @@ function updateComponentJson (name, jsonObj, usingComponents = true, type = 'Com
function updateUsingGlobalComponents (name, usingGlobalComponents) { function updateUsingGlobalComponents (name, usingGlobalComponents) {
const manifestConfig = process.UNI_MANIFEST; const manifestConfig = process.UNI_MANIFEST;
const weixinConfig = manifestConfig['mp-weixin']; const weixinConfig = manifestConfig['mp-weixin'];
const independentSwitch = !!weixinConfig.independentSwitch; const independentSwitch = !!weixinConfig.independent;
if (!independentSwitch && supportGlobalUsingComponents) { if (!independentSwitch && supportGlobalUsingComponents) {
return; return;
......
...@@ -211,7 +211,7 @@ function parseEntry (pagesJson) { ...@@ -211,7 +211,7 @@ function parseEntry (pagesJson) {
} }
const manifestConfig = process.UNI_MANIFEST; const manifestConfig = process.UNI_MANIFEST;
const weixinConfig = manifestConfig['mp-weixin'] || {}; const weixinConfig = manifestConfig['mp-weixin'] || {};
const independentSwitch = !!weixinConfig.independentSwitch; const independentSwitch = !!weixinConfig.independent;
if (independentSwitch) { if (independentSwitch) {
Object.values(process.UNI_SUBPACKAGES).forEach(({ root, independent = false }) => { Object.values(process.UNI_SUBPACKAGES).forEach(({ root, independent = false }) => {
if (root && independent) { if (root && independent) {
......
...@@ -11,7 +11,7 @@ const AppInterceptorPlugin = require('./independent-plugins/app-interceptor-plug ...@@ -11,7 +11,7 @@ const AppInterceptorPlugin = require('./independent-plugins/app-interceptor-plug
module.exports = function createIndependentPlugins () { module.exports = function createIndependentPlugins () {
const manifestConfig = process.UNI_MANIFEST; const manifestConfig = process.UNI_MANIFEST;
const weixinConfig = manifestConfig['mp-weixin']; const weixinConfig = manifestConfig['mp-weixin'];
const independentSwitch = !!weixinConfig.independentSwitch; const independentSwitch = !!weixinConfig.independent;
if (!independentSwitch) return []; if (!independentSwitch) return [];
// 支持构造微信小程序的独立分包 // 支持构造微信小程序的独立分包
...@@ -27,7 +27,7 @@ module.exports = function createIndependentPlugins () { ...@@ -27,7 +27,7 @@ module.exports = function createIndependentPlugins () {
new AppInterceptorPlugin() new AppInterceptorPlugin()
]; ];
const insertAppCssToIndependentSwitch = !!weixinConfig.insertAppCssToIndependentSwitch; const insertAppCssToIndependentSwitch = !!weixinConfig.insertAppCssToIndependent;
if (insertAppCssToIndependentSwitch) { if (insertAppCssToIndependentSwitch) {
// 需要在 cacheSet 后面 // 需要在 cacheSet 后面
independentPlugins.push(new InjectMainCssToIndependentCssPlugin()); // 目前只对页面注入了,组件未注入 independentPlugins.push(new InjectMainCssToIndependentCssPlugin()); // 目前只对页面注入了,组件未注入
......
...@@ -35,7 +35,7 @@ function copyWeuiCssToIndependent (independentRoot) { ...@@ -35,7 +35,7 @@ function copyWeuiCssToIndependent (independentRoot) {
function tryInsertWeuiCss (independentRoot, originalWxssStr) { function tryInsertWeuiCss (independentRoot, originalWxssStr) {
const manifestConfig = process.UNI_MANIFEST; const manifestConfig = process.UNI_MANIFEST;
const weixinConfig = manifestConfig['mp-weixin'] || {}; const weixinConfig = manifestConfig['mp-weixin'] || {};
const independentSwitch = !!weixinConfig.independentSwitch; const independentSwitch = !!weixinConfig.independent;
// 如果使用了weui,则需要注入weui样式 // 如果使用了weui,则需要注入weui样式
const useExtendedWeUi = !!(weixinConfig.useExtendedLib || {}).weui; const useExtendedWeUi = !!(weixinConfig.useExtendedLib || {}).weui;
......
...@@ -13,8 +13,8 @@ class DependencyAnalyze { ...@@ -13,8 +13,8 @@ class DependencyAnalyze {
init (emitFileMap, compilation) { init (emitFileMap, compilation) {
const manifestConfig = process.UNI_MANIFEST; const manifestConfig = process.UNI_MANIFEST;
const weixinConfig = manifestConfig['mp-weixin'] || {}; const weixinConfig = manifestConfig['mp-weixin'] || {};
const independentSwitch = !!weixinConfig.independentSwitch; const independentSwitch = !!weixinConfig.independent;
const copyWxComponentsOnDemandSwitch = !!weixinConfig.copyWxComponentsOnDemandSwitch; // 默认值false const copyWxComponentsOnDemandSwitch = !!weixinConfig.copyWxComponentsOnDemand; // 默认值false
if (copyWxComponentsOnDemandSwitch) { // 开启按需复制 if (copyWxComponentsOnDemandSwitch) { // 开启按需复制
new CopyWxComponentOnDemand(emitFileMap, this.AnalyzeWxcomponentDependency, compilation).init(); new CopyWxComponentOnDemand(emitFileMap, this.AnalyzeWxcomponentDependency, compilation).init();
......
...@@ -44,7 +44,7 @@ module.exports = { ...@@ -44,7 +44,7 @@ module.exports = {
const manifestConfig = process.UNI_MANIFEST; const manifestConfig = process.UNI_MANIFEST;
const weixinConfig = manifestConfig['mp-weixin'] || {}; const weixinConfig = manifestConfig['mp-weixin'] || {};
const copyWxComponentsOnDemandSwitch = !!weixinConfig.copyWxComponentsOnDemandSwitch; // 默认值false const copyWxComponentsOnDemandSwitch = !!weixinConfig.copyWxComponentsOnDemand; // 默认值false
if (!copyWxComponentsOnDemandSwitch) { if (!copyWxComponentsOnDemandSwitch) {
const wxcomponentsDir = path.resolve(process.env.UNI_INPUT_DIR, COMPONENTS_DIR_NAME); const wxcomponentsDir = path.resolve(process.env.UNI_INPUT_DIR, COMPONENTS_DIR_NAME);
......
...@@ -224,9 +224,9 @@ module.exports = function generateJson (compilation) { ...@@ -224,9 +224,9 @@ module.exports = function generateJson (compilation) {
for (const [name, jsonObj] of emitFileMap) { for (const [name, jsonObj] of emitFileMap) {
if (name === 'app.json') { // 删除manifest.json携带的配置项 if (name === 'app.json') { // 删除manifest.json携带的配置项
delete jsonObj.insertAppCssToIndependentSwitch; delete jsonObj.insertAppCssToIndependent;
delete jsonObj.independentSwitch; delete jsonObj.independent;
delete jsonObj.copyWxComponentsOnDemandSwitch; delete jsonObj.copyWxComponentsOnDemand;
} else { // 删除用于临时记录的属性 } else { // 删除用于临时记录的属性
delete jsonObj.usingGlobalComponents; delete jsonObj.usingGlobalComponents;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册