-
Notifications
You must be signed in to change notification settings - Fork 194
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
[WIP] build: 构建产物调整, 使用 Bundless 的方式输出, 支持 tree shaking [BREAK CHANGE] #2754
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
你好, @lijinke666 CI 执行失败, 请点击 [Details] 按钮查看, 并根据日志修复 Hello, @lijinke666 CI run failed, please click the [Details] button for detailed log information and fix it. |
Size Change: +24.8 kB (+7.61%) 🔍 Total Size: 350 kB
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #2754 +/- ##
==========================================
+ Coverage 75.77% 80.19% +4.42%
==========================================
Files 257 176 -81
Lines 11994 10170 -1824
Branches 2464 2330 -134
==========================================
- Hits 9088 8156 -932
+ Misses 1398 597 -801
+ Partials 1508 1417 -91 ☔ View full report in Codecov by Sentry. |
@@ -0,0 +1,134 @@ | |||
import { viteCommonjs } from '@originjs/vite-plugin-commonjs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
和之前的配置没变, 之前这几个包打包配置都是复制的, 重复率有点高, 抽了下, 现在使用 father 打包, 用不到了 (暂时保留, 以免有啥问题)
@@ -2,12 +2,12 @@ import { isEmpty } from 'lodash'; | |||
import { CellType } from '../common/constant'; | |||
import { CellBorderPosition, type ViewMeta } from '../common/interface'; | |||
import type { SpreadSheet } from '../sheet-type'; | |||
import { getBorderPositionAndStyle } from '../utils'; | |||
import { renderLine, renderPolygon } from '../utils/g-renders'; | |||
import { getBorderPositionAndStyle } from '../utils/cell/cell'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
路径/函数移动 都是解决循环依赖.
@@ -0,0 +1,140 @@ | |||
import { find, forEach, includes, isEqual } from 'lodash'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
移位置, 忽略
}, | ||
umd: { | ||
alias: { | ||
'@antv/s2': path.resolve(__dirname, 'packages/s2-core'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
避免 bundle 时找不到 antv/s2
的问题
|
||
export default (name: string) => { | ||
const alias = { | ||
'@antv/s2-shared': path.resolve(process.cwd(), './src/shared'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -22,8 +22,10 @@ if (window) { | |||
|
|||
// 本地通过 monorepoRedirect link 时不需要引入样式, 发布时引入, 避免样式丢失 | |||
if (process.env.NODE_ENV === 'production') { | |||
(window as any).s2CSS = require('@antv/s2/dist/style.min.css'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文档相关的改动直接忽略, 都是批量替换
@@ -5,7 +5,7 @@ | |||
"strictPropertyInitialization": false, | |||
"allowSyntheticDefaultImports": true, | |||
"module": "esnext", | |||
"declaration": false, | |||
"declaration": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用 ts 自带的类型生成, s2-vue
除外, father 解析不了.
因依赖拆包, 合并到 #2887 中一起处理 |
👀 PR includes
🔧 Chore
📝 Description
📦 构建产物调整
ESModule/CommonJS
所有包的
ESModule (esm)
和CommonJS (lib)
构建产物从Bundle
调整为Bundless
, 其所依赖的子模块会被直接拷贝输出,不再做编译,以便于更好的支持代码tree shaking
, 减少包体积。由于
@antv/s2-shared
是未发布的包, 只作用公用模块使用, 所以作为子目录拷贝进s2-(react/react-componnents/vue)
中进行Bundle
构建. 以兼容Bundless
的方式.UMD
所有包的
UMD (dist)
构建产物依然为Bundle
单文件,文件名和全局变量名有所调整:@antv/s2
dist/index.min.js
dist/style.min.css
dist/s2.min.css
dist/s2.min.css
@antv/s2-react
dist/index.min.js
dist/style.min.css
dist/s2-react.min.css
dist/s2-react.min.css
@antv/s2-vue
dist/index.min.js
dist/style.min.css
dist/s2-vue.min.css
dist/s2-vue.min.css
@antv/s2
S2
S2
@antv/s2-react
S2-React
S2React
@antv/s2-vue
S2-Vue
S2Vue
🖼️ Screenshot
🔗 Related issue link
close #2404
🔍 Self-Check before the merge