Skip to content
This repository was archived by the owner on Mar 7, 2024. It is now read-only.

Commit 7ca4938

Browse files
committed
fix: 修复 createHostComponent 无法正确注册组件的问题
1 parent 5f723ac commit 7ca4938

5 files changed

Lines changed: 46 additions & 4 deletions

File tree

packages/remax-cli/src/__tests__/integration/fixtures/createHostComponent/expected/__remax_runtime_options__.js

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/remax-cli/src/__tests__/integration/fixtures/createHostComponent/expected/pages/index.axml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/remax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/__remax_runtime_options__.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/remax-cli/src/__tests__/integration/fixtures/turbo-pages-basic/expected/pages/index.axml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/remax-macro/src/createHostComponent.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import * as t from '@babel/types';
22
import { NodePath } from '@babel/traverse';
3-
import { HostComponent } from '@remax/types';
3+
import Store from '@remax/build-store';
44
import insertImportDeclaration from './utils/insertImportDeclaration';
55

66
const PACKAGE_NAME = '@remax/runtime';
77
const FUNCTION_NAME = 'createHostComponent';
88

9-
export const hostComponents: Map<string, HostComponent> = new Map();
10-
119
function getConfig(callExpression: NodePath<t.CallExpression>) {
1210
const args = callExpression.node.arguments;
1311
const name = args[0] as t.StringLiteral;
@@ -38,7 +36,7 @@ export default function createHostComponent(path: NodePath, state: any) {
3836
return prev;
3937
}, {});
4038

41-
hostComponents.set(name.value, {
39+
Store.registeredHostComponents.set(name.value, {
4240
props,
4341
alias,
4442
additional: true,

0 commit comments

Comments
 (0)