remaxjs / remax

使用真正的 React 构建跨平台小程序
https://remaxjs.github.io/remax/
MIT License
4.57k stars 365 forks source link

[BUG] 在使用storybook时,导入remax组件失败 #1501

Closed shruckCode closed 3 years ago

shruckCode commented 3 years ago

bug 描述 [详细地描述 bug,让大家都能理解] 在使用storybook开发remax组件时,导入remax组件如下

import React from "react";

import { View } from "remax/wechat";
import { Button } from "@storybook/react/demo";

export default {
  title: "UI 组件",
  component: View,
};

export const Default = () => <Button >Button默认</Button>;
export const Other = () => <View>这是一个测试</View>;

复现步骤 [清晰描述复现步骤,让别人也能看到问题]

期望结果 [描述你原本期望看到的结果]

复现代码 [请提供一个可复现问题的代码仓库]

版本信息:

PS D:\workplace\remax-ks\ks> npm info remax

remax@2.11.6 | MIT | deps: 11 | versions: 534 Remax 是一个全新的基于 React 的小程序开发框架 https://remaxjs.org

bin: remax

dist .tarball: https://registry.npm.taobao.org/remax/download/remax-2.11.6.tgz .shasum: 60aeaa2fdad5db37b621a05d5ed2c3b47a8366ab

dependencies: @remax/ali: 2.11.6 @remax/one: 2.11.6 @remax/types: 2.11.6 mini-types: ^0.1.1 @remax/cli: 2.11.6 @remax/runtime: 2.11.6 @remax/web: 2.11.6 miniprogram-api-typings: ^3.1.3 @remax/macro: 2.11.6 @remax/toutiao: 2.11.6 @remax/wechat: 2.11.6

maintainers:

dist-tags: alpha: 2.0.1-14eb47bb.0 latest: 2.11.6 next: 2.0.0-alpha.18

其他信息 [如截图等其他信息可以贴在这里] 错误输出
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of unboundStoryFn.

yesmeck commented 3 years ago

remax/wechat 的组件只能跑在微信上。remax/one 的组件才是跨平台的。