-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
adb4513
commit 90f3ba1
Showing
1 changed file
with
26 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,32 @@ | ||
# console important message with color tags | ||
# console message with color tags | ||
![示例](./images/[email protected]) | ||
|
||
## Usage | ||
## rspack | ||
```typescript | ||
import { PrettyConsoleWebpackPlugin } from '@sprit/pretty-console-webpack-plugin'; | ||
rspack: (config, { appendPlugins, HtmlPlugin }) => { | ||
appendPlugins(new ConsoleTagRspackPlugin({ HtmlPlugin })) | ||
}, | ||
``` | ||
|
||
## configure | ||
## webpack | ||
```typescript | ||
|
||
new PrettyConsoleWebpackPlugin({ | ||
git: { | ||
branch: true, | ||
hash: 7, | ||
lastCommitDateTime: true | ||
}, | ||
custom() { | ||
return { | ||
'构建版本': process.env.BUILD_VERSION // 环境变量 | ||
}; | ||
} | ||
}) | ||
webpackChain(config, { HtmlPlugin }) { | ||
config.plugin('tag').use( | ||
new ConsoleTagWebpackPlugin( | ||
{ | ||
HtmlPlugin, | ||
git: { | ||
branch: true, | ||
hash: 7, | ||
lastCommitDateTime: true, | ||
}, | ||
custom() { | ||
return { | ||
构建版本: process.env.BUILD_VERSION ?? '-', | ||
}; | ||
}, | ||
} | ||
) | ||
) | ||
} | ||
``` | ||
|
||
## Output(console) | ||
![示例](./images/[email protected]) |