From b2acc04871d4a68ade55439057576a2f841d03e0 Mon Sep 17 00:00:00 2001 From: Malash Date: Tue, 11 Jul 2023 16:59:22 +0800 Subject: [PATCH] inline the content of `children.wxml` into `component.wxml` to support new Baidu compiler on dev tool >= v4.22 --- packages/webpack-plugin/src/constants/features.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/webpack-plugin/src/constants/features.ts b/packages/webpack-plugin/src/constants/features.ts index 8894221..6aa2008 100644 --- a/packages/webpack-plugin/src/constants/features.ts +++ b/packages/webpack-plugin/src/constants/features.ts @@ -3,10 +3,15 @@ import { GojiTarget } from '@goji/core'; export const getFeatures = (target: GojiTarget) => ({ useSubtree: target === 'wechat' || target === 'qq', - // Alipay only support recursion dependency self to self so we have to inline the children.wxml - // Success: A -> A -> A - // Fail: A -> B -> A - useInlineChildrenInComponent: target === 'alipay', + useInlineChildrenInComponent: + // Alipay only support circular dependency self to self so we have to inline the children.wxml + // Success: A -> A -> A + // Fail: A -> B -> A + target === 'alipay' || + // Baidu changes the behavior of circular dependency on dev tool >= v4.22 with new compiler + // so we have to inline the children.wxml + // https://smartprogram.baidu.com/docs/develop/devtools/beta-notify#_5-%E6%A8%A1%E6%9D%BF-import-%E8%AF%AD%E6%B3%95%E4%B8%8D%E5%85%81%E8%AE%B8%E5%BE%AA%E7%8E%AF%E5%BC%95%E7%94%A8%E3%80%82 + target === 'baidu', // Baidu fails to render if an outside same `` exists // https://github.com/airbnb/goji-js/issues/185