relative-ci / roadmap

Issues, questions and feature requests for RelativeCI
https://relative-ci.com
3 stars 0 forks source link

Feature - Hide the stats.json from project summary #18

Closed Mozart409 closed 4 years ago

Mozart409 commented 4 years ago

Hello,

awesome product by the way. Been using it for three days and I love it. I want to hide my stats.json from the project summary. Is that possible?

grafik grafik

Maybe we can hide the stats.json file from the relative.config.js?

vio commented 4 years ago

To ignore assets from the report, you need to pass webpack stats.excludeAssets option to RelativeCiAgentWebpackPlugin or StatsWritterPlugin:

Webpack plugin example

// webpack.config.js
const { RelativeCiAgentWebpackPlugin } = require('@relative-ci/agent');

module.exports = {
  // ... your webpack config
  plugins: [
    // ... other plugins
    new RelativeCiAgentWebpackPlugin({
      stats: {
        excludeAssets: [/webpack-stats.json/]
      }
    })
  ]
};

CLI setup example

// webpack.config.js
const { StatsWriterPlugin } = require("webpack-stats-plugin")

module.exports = {
  // ... your webpack config
  plugins: [
    // ... other plugins

    // Write out stats file to build directory.
    new StatsWriterPlugin({
      filename: 'stats.json',
      stats: {
        context: './src', // optional, will improve readability of the paths
        assets: true,
        entrypoints: true,
        chunks: true,
        modules: true,
        excludeAssets: [/webpack-stats.json/]
      }
    })
  ]
}