-
Notifications
You must be signed in to change notification settings - Fork 73
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
feat: 🎸 report size #335
feat: 🎸 report size #335
Conversation
maoxiaoke
commented
Apr 22, 2022
- closes 输出 bundle 的文件大小 & gzip 信息 #292
packages/pkg/src/types.ts
Outdated
@@ -48,7 +52,7 @@ export type PkgPluginAPI = IPluginAPI<TaskConfig>; | |||
|
|||
export type PkgPlugin = IPlugin<TaskConfig>; | |||
|
|||
export type TaskName = 'pkg-cjs' | 'pkg-esm' | 'pkg-es2017' | 'pkg-dist-es5' | 'pkg-dist-es2017'; | |||
export type TaskName = 'cjs' | 'esm' | 'es2017' | 'dist-es5' | 'dist-es2017'; |
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.
- cjs -> transform-cjs
- dist-es5 -> bundle-es5
这样会好点吗?
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.
我看好多地方用到这个变量,建议通过 constants 抽象掉,改起来也好改一些。
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.
done
// Configure task outputDir(Taskname 以 pkg-[cjs|esm|es2017 命名]) | ||
normalizedConfig.outputDir = outputDir || join(rootDir, taskName.split('-')[1]); | ||
// Configure task outputDir | ||
normalizedConfig.outputDir = outputDir || getOutputDir(rootDir, taskName as TaskName); |
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.
ctx 已经定义了 PkgContext,这里的 TaskName 的断言是不是多余了
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.
嗯,build-scripts 返回的还是 string 类型,需要支持一下
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.
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.