Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix: 修正 vite 构建报错的问题 #40

Merged
merged 1 commit into from
Mar 29, 2023
Merged

Conversation

arvinxx
Copy link
Collaborator

@arvinxx arvinxx commented Mar 29, 2023

动态化按需引入 emotion/server 依赖 ,fix #38

@github-actions
Copy link

github-actions bot commented Mar 29, 2023

🎊 PR Preview 9c8638f has been successfully built and deployed to https://ant-design-antd-style-preview-pr-40.surge.sh

🕐 Build time: 109.635s

🤖 By surge-preview

@arvinxx arvinxx merged commit 9415799 into beta Mar 29, 2023
@arvinxx arvinxx deleted the fix-vite-build branch March 29, 2023 17:39
github-actions bot pushed a commit that referenced this pull request Mar 29, 2023
# [3.0.0-beta.21](v3.0.0-beta.20...v3.0.0-beta.21) (2023-03-29)

### 🐛 Bug Fixes

* 将 emotion/server 的引入动态化 ([9415799](9415799)), closes [#40](#40)
@github-actions
Copy link

🎉 This PR is included in version 3.0.0-beta.21 🎉

The release is available on:

Your semantic-release bot 📦🚀

github-actions bot pushed a commit that referenced this pull request Apr 4, 2023
# [3.0.0](v2.0.2...v3.0.0) (2023-04-04)

### ♻ Code Refactoring

* 将 styled 语法替换回 @emotion/styled ([4733e00](4733e00))
* 移除暴露的静态方法,通过回调接口实现实例的转发 ([9b9e340](9b9e340))

### ✨ Features

* antd stylish 模块实现 ([86e1abb](86e1abb))
* AppContainer 支持亮暗模式主题切换 ([bfd9922](bfd9922))
* createInstance 方法支持声明自定义 token 默认值 ([4122038](4122038))
* createStyles 入参支持 appearance 和 injectGlobal ([0b1d947](0b1d947))
* css 和 cx 对象从独立instance 中导出 ([d927630](d927630))
* extractStaticStyle 提供 antd 的ids 计数 ([47254d3](47254d3))
* extractStaticStyle 支持传入 antdCache ([d87ddde](d87ddde))
* extractStaticStyle 支持抽取 antd 样式 ([5d0d10c](5d0d10c))
* styled 方法底层实现替换为 styled-component 以默认支持组件选择器 ([0ccbcaf](0ccbcaf))
* useTheme 中增加 appearance 等主题状态属性 ([6ce3b7d](6ce3b7d))
* useThemeMode 支持获取当前浏览器主题模式 ([a4e2e67](a4e2e67))
* 为 createStyles 添加 isDarkMode 入参 ([ee1def0](ee1def0))
* 为 ThemeProvider 增加主题切换的能力 ([e15668a](e15668a))
* 为 ThemeProvider 补齐主题切换的能力 ([52b68d5](52b68d5))
* 优化 css-prefix key 为 acss 以减少样式类名体积 ([d367033](d367033))
* 优化 StyledProvider 实现逻辑并新增 useEmotion 的 hook ([d9d8014](d9d8014))
* 优化类型定义使用 ([d4a57ae](d4a57ae))
* 使用 reactCss 替换 css 对象 ([0b42a0a](0b42a0a))
* 初步支持响应式工具函数 ([244162d](244162d))
* 在各方法中新增 prefixCls 的参数 ([33d23b4](33d23b4))
* 实现 setupStyled ([d66d50d](d66d50d))
* 导出 sheet 对象,用于测试 qiankun 下样式会丢失的 bug ([32f273e](32f273e))
* 将 extractStyle 改名为 extractStaticStyle ,与 antd cssinjs 的错开 ([89f17dc](89f17dc))
* 将 r 改名为 responsive ([022c25b](022c25b))
* 将 stylish 的接口从 styled 方法中移除,二者并不兼容 ([90809f9](90809f9))
* 将主题配置中的 antd 主题配置与算法导出供自定义时使用 ([90a291d](90a291d))
* 提供 ssr 抽取方法 extractStyle ([8d22e4a](8d22e4a))
* 提供全局 cache 列表存放样式缓存供SSR消费 ([4777e1b](4777e1b))
* 支持 useTheme 获取默认的主题变量 ([a465bf4](a465bf4))
* 支持使用 antd-style 的 StyleProvider 做 SSR ([6c0b017](6c0b017))
* 支持基于主题模式的风格定制 ([3f5d2cb](3f5d2cb))
* 支持嵌套Provider 后还能获得准确的 theme 值 ([8581665](8581665))
* 新增 createInstance 方法,并用 createInstance 重构相关功能导出 ([39a05ae](39a05ae))
* 新增 StyledProvider 以新增多 emotion 实例的能力 ([c4feb3b](c4feb3b))
* 新增 useResponse hooks ([7e4f632](7e4f632))
* 替换默认的 css 导出 ([8124791](8124791))
* 添加 staticInstanceConfig api 以支持静态实例的配置 ([fdca322](fdca322))
* 添加 styled api,支持 styled 方法响应自定义 token ([a152c33](a152c33))
* 移除 styled 的默认导出 ([9ced0aa](9ced0aa))
* 移除 useEmotion 方法 ([7f7a59e](7f7a59e))
* 移除若干无用api 并调整样式表实例为 styleManager ([8dafbc4](8dafbc4))
* 简化 ThemeProvider 注入 styled 的接口配置 ([84f828c](84f828c))
* 经过讨论移除 AppContainer 容器组件,直接使用 antd 的 App 即可 ([0ff52d3](0ff52d3))
* 自动监听浏览器主题能力兼容 ssr 场景 ([283ca09](283ca09))
* 自定义增加一个 isDark 字段 ([ac0fb23](ac0fb23))
* 调整 stylish 的实现逻辑 ([1822b38](1822b38))
* 通过实际使用测试,移除 AppContainer 上的 globalStyle props ([1d3ee08](1d3ee08))

### 🐛 Bug Fixes

* cache 设为可选项 ([495cd78](495cd78))
* ThemeAppearance 字段支持自定义字符 ([2bd7007](2bd7007))
* 优化类型代码导出问题 ([e1d4264](e1d4264))
* 优化类型代码导出问题 ([d3cf3ef](d3cf3ef))
* 修正 @ant-design/cssinjs 作为 deps ([912a59f](912a59f))
* 修正 antd theme 配置没有导出的问题 ([a374437](a374437))
* 修正 createGlobalStyle 类型找不到的问题 ([64fda0f](64fda0f))
* 修正 createInstance 的 ThemeProvider 会全量覆盖默认的自定义 token 问题 ([9477630](9477630))
* 修正 createStyles 的类型定义,避免无法正常跳转 ([4bef457](4bef457))
* 修正 createStyles 类型不正确的问题 ([bacdc0b](bacdc0b))
* 修正 CSS Object 和 CSS String 同时存在时的类型定义问题 ([bd38764](bd38764))
* 修正 CSS Object 模式下的类型定义问题 ([0521200](0521200))
* 修正 cx 下 where 选择器不正常显示的问题 ([a641ace](a641ace))
* 修正 GetCustom 相关方法类型没导出的问题 ([db6727c](db6727c))
* 修正 matchBrowserPrefer 在 SSR 下无法正常使用的问题 ([660a338](660a338))
* 修正 message、notification 组件 prefix 不对的问题 ([01380ee](01380ee))
* 修正 reactCss 构建产物判断逻辑问题 ([a8288c2](a8288c2))
* 修正 SSR 下 CacheManager 找不到的问题 ([362723a](362723a))
* 修正 styled 导出问题 ([8141d78](8141d78))
* 修正 styled 类型导出的问题 ([74551ed](74551ed))
* 修正 StyleProvider 的类型定义 ([780bf91](780bf91))
* 修正 theme props 类型定义失效的问题 ([2c3749c](2c3749c))
* 修正 ThemeProvider 子组件类型定义问题 ([3066b81](3066b81))
* 修正 vite 模式下 global 为 undefined 的问题 ([d0a19ba](d0a19ba))
* 修正 withTheme 丢失的问题 ([c032827](c032827))
* 修正使用 styled ThemeProvider 后 useTheme 方法不响应自定义 token 的问题 ([35d87a9](35d87a9))
* 修正在添加 ThemeProvider 后 customToken 设定会丢失的问题 ([936e43b](936e43b))
* 修正相关类型导出丢失的问题 ([1cb24d9](1cb24d9))
* 修正类型定义 ([8a7d053](8a7d053))
* 修正类型定义不准确的问题 ([d318382](d318382))
* 修正类型定义不匹配的问题 ([788a3ec](788a3ec))
* 修正类型定义调整后 ()=>css`` 的使用方式类型定义不正确的问题 ([823ea12](823ea12))
* 修正自定义 stylish 的问题 ([61f195e](61f195e))
* 修正设定主题后仍然响应系统主题的bug ([b44be0c](b44be0c))
* 将 emotion/server 的引入动态化 ([9415799](9415799)), closes [#40](#40)
* 尝试优化类型问题 ([b6f2b62](b6f2b62))
* 尝试修正类型定义问题 ([207019f](207019f))
* 移除不需使用类型定义 ([f9ee190](f9ee190))
* 经过思考 create({ 单个 css obj }) 这个使用方式不合理,将其移出基础的类型定义对象中 ([51ed579](51ed579))
* 经过讨论,移除 injectGlobal 在 createStyles 中的入参 ([d6d2aaf](d6d2aaf))
* 补回 CacheManager 类型 ([b95093f](b95093f))
* 补回 injectGlobal 方法丢失的问题 ([111bcc7](111bcc7))
* 重构优化类型 ([4472a2b](4472a2b))
* 重构类型定义,使用入参更加准确 ([6c94ae6](6c94ae6))
* 默认 cache-key 改为 css ([a2b585a](a2b585a))

### 💥 BREAKING CHANGES

* stylish 将不再能直接作为 className 使用,需要通过 css 包裹才能生效,将 stylish 的定位变得更加精准 —— 可复用的样式片段
* useTheme 的默认返回值发生变动,默认返回 antd token 值
* 不再计划默认支持组件选择器
* 为了方便用户理解,将 r 改名为 responsive
* 将 antd-style 中导出的 css 都替换为 `@emotion/react` 的 css,建立起 css`` -> styleObject 的心智。

原因:由于 emotion/css 的 css`` 只产出 className,因此无法做一些复杂操作,例如样式片段复用,需要替换为 react 的版本
* 由于 emotion/react 版本的 styled 无法默认支持组件选择器。虽然可以用 babel-plugin 配置,但是太过于复杂,因此考虑直接替换为styled-components
* 移除 AppContainer
* 移除 AppContainer 的 globalStyle props
* 移除 styled.useTheme 的用法,需要调整为 styled.ThemeContext,且 styled 的ThemeProvider 可以无需注入
* 移除 useEmotion 方法,用户不应该感知内部实现的实例对象
* 移除直接暴露的静态实例
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant