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

fix: 独立分包开关名修改

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