Skip to content

美化 console 输出的插件(webpack+rspack)

License

Notifications You must be signed in to change notification settings

fantian007/console-tag

Repository files navigation

console message with color tags

示例

rspack

rspack: (config, { appendPlugins, HtmlPlugin }) => {
  appendPlugins(new ConsoleTagRspackPlugin({ HtmlPlugin }))
},

webpack

webpackChain(config, { HtmlPlugin }) {
  config.plugin('tag').use(
    new ConsoleTagWebpackPlugin(
      {
        HtmlPlugin,
        git: {
          branch: true,
          hash: 7,
          lastCommitDateTime: true,
        },
        custom() {
          return {
            构建版本: process.env.BUILD_VERSION ?? '-',
          };
        },
      }
    )
  )
}