我有一个多入口点webpack构建,我正在努力优化生产的工件大小.webpack-bundle-analyzer产生了以下图片:
很明显,AtlasKit依赖项构成了总工件大小的很大一部分.具体来说,我看到这种styled-components.es.js情况重复了很多次.更重要的是,同样的依赖性也存在于vendor.js其中所有其他包之间共享.
任何人都可以解释为什么styled-components.es.js重复全部以及为什么它不能通过单一依赖共享vendor.js?我有什么办法可以删除重复项并且只依赖于单个styled-components.es.js依赖项vendor.js吗?
我发现AtlasKit依赖项有一个node_modules包含在包中的嵌套文件夹有点奇怪.为什么dist还不够?也许这是为什么styled-components.es.js不能通过共享的部分原因vendor.js?
我试图通过webpack的IgnorePlugin(类似于moment.jslocales)手动排除依赖,但到目前为止失败了.
任何见解将不胜感激.谢谢!
将@atalaskit/form从版本 2.1.2 更新到最新版本 (5.2.7)后,我遇到了问题。
这个新更新利用了export { default } from './File'我认为我的 babel 和/或 webpack 不支持的功能。
到目前为止,我发现 create-react-app 2.1.8 可以很好地运行此语法。
另外,我在这里找到了这种语法: https: //github.com/tc39/proposal-export-default-from
我尝试将此提案包含在我的 .babelrc 文件中,但错误仍然存在。
@atlaskit/form/index.js(错误出现的地方)
export { default } from './Form';
export { default as FormHeader } from './FormHeader';
export { default as FormFooter } from './FormFooter';
export { default as FormSection } from './FormSection';
export { default as Field } from './Field';
export { default as CheckboxField } from './CheckboxField';
export { HelperMessage, ErrorMessage, ValidMessage } …Run Code Online (Sandbox Code Playgroud) 好吧,我看到了下面的代码片段,我想知道type Props真正的含义是什么?与流量有关吗?还是和道具类型有关?
如何在定义为类的组件中使用它?
我在这里找到的React-Router示例中看到了它:https : //atlaskit.atlassian.com/packages/core/navigation
代码段:
// @flow
import React from "react";
import { AtlassianIcon } from "@atlaskit/logo";
import Lorem from "react-lorem-component";
import Page from "@atlaskit/page";
import Navigation, { AkContainerTitle } from "@atlaskit/navigation";
import RouterLinkComponent from "./RouterLinkComponent";
import RouterLinkItem from "./RouterLinkItem";
// @flow
type Props = {
title: string,
currentPath: string
};
const PageNavigation = ({ title, currentPath }: Props) => (
<Page
navigation={
<Navigation
containerHeaderComponent={() => (
<AkContainerTitle
href="/iframe.html"
icon={<AtlassianIcon label="atlassian" />}
linkComponent={RouterLinkComponent}
text="Dashboard"
/> …Run Code Online (Sandbox Code Playgroud) 我正在尝试获得一个简单的受控组件,该组件输出一串 html 并接收一串 html。
不幸的是,atlaskit 团队关闭了 repo 中的问题。我在谷歌上看到这个链接,但实际上在 bitbucket 上看不到它(叹气):https : //bitbucket.org/atlassian/atlaskit-mk-2/issues/89/way-to-get-html-as-它在地图集内
有没有其他人试过这个?似乎没有任何文档被更新。defaultValue 字段,当给定一个字符串时,会吐出“无效的 json”。
https://atlaskit.atlassian.com/packages/editor/editor-core
import { EditorContext, WithEditorActions } from '@atlaskit/editor-core';
import { CollapsibleEditor } from 'previous-example';
<EditorContext>
<div>
<CollapsibleEditor />
<WithEditorActions
render={actions => (
<ButtonGroup>
<Button onClick={() => actions.clear()}>Clear Editor</Button>
<Button onClick={() => actions.focus()}>Focus Editor</Button>
</ButtonGroup>
)}
/>
</div>
</EditorContext>;
Run Code Online (Sandbox Code Playgroud)
上面的示例不起作用,任何据称为编辑器准备好值的“转换器”也不起作用。
https://atlaskit.atlassian.com/packages/editor/editor-json-transformer
从我收集的一点点来看,似乎需要一个
It sucks because the editor is beautiful and all the other facets seems to be working well, I just can't get a damn …