Skip to content

Commit

Permalink
fix: 修复合并4.x solid的问题 (#15840)
Browse files Browse the repository at this point in the history
* fix: 修复合并的问题

* chore

* Update index.ts

---------

Co-authored-by: ZEJIA LIU <[email protected]>
  • Loading branch information
phy-lei and ZEJIA-LIU authored Jun 4, 2024
1 parent 1d4ad43 commit 11ddfcd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
5 changes: 3 additions & 2 deletions packages/babel-preset-taro/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ module.exports = (_, options = {}) => {
const isVite = options.compiler === 'vite'
// vite 不需要 react 的 preset,在内部已经处理了
const isReact = options.framework === 'react' || options.framework === 'preact' && !isVite
const isSolid = options.framework === 'solid'
// vite 不需要 solid 的 preset,在内部已经处理了
const isSolid = options.framework === 'solid' && !isVite
// vite 不需要 vue 的 preset,在内部已经处理了
const isVue3 = options.framework === 'vue3' && !isVite
// vite 不需要使用 babel 处理 ts,在 esbuild 中处理了
Expand Down Expand Up @@ -67,7 +68,7 @@ module.exports = (_, options = {}) => {
})
}
presets.push([
require('babel-plugin-transform-solid-jsx-ad-taro-components'),
require('babel-plugin-transform-solid-jsx'),
solidOptions,
])
}
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-framework-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { IPluginContext } from '@tarojs/service'
import type { IProjectConfig } from '@tarojs/taro/types/compile'
import type { PluginOption } from 'vite'

export type Frameworks = 'react' | 'preact' | 'solid' | 'vue3'
export type Frameworks = 'react' | 'preact'

export function isReactLike(framework: IProjectConfig['framework'] = 'react'): framework is Frameworks {
return ['react', 'preact'].includes(framework)
Expand Down
7 changes: 0 additions & 7 deletions packages/taro-framework-solid/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,5 @@ export default (ctx: IPluginContext) => {
componentConfig.includes.add(nodeName)
}
})

// 映射、收集使用到的小程序组件
ctx.onParseCreateElement(({ nodeName, componentConfig }: IParseCreateElementArgs) => {
if (capitalize(toCamelCase(nodeName)) in internalComponents) {
componentConfig.includes.add(nodeName)
}
})
}

0 comments on commit 11ddfcd

Please sign in to comment.