How to use webpack-optimize-helper - 4 common examples

To help you get started, we’ve selected a few webpack-optimize-helper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jakoblind / webpack-autoconf / src / pages / optimize.js View on Github external
{_.map(dependenciesNotEs6, dep => (
              
                {dep.name} {formatBytes(dep.size)}
              
            ))}
github jakoblind / webpack-autoconf / src / pages / optimize.js View on Github external
.{' '}
      <p></p>
      
          {_.map(entrypointAssetSizes, e =&gt; (
            
          ))}
          <table>
        <tbody><tr>
              <td>
                <code>{e.name}</code>
              </td>
              <td>{e.size}</td>
            </tr><tr>
            <td>Total</td>
            <td>
              {formatBytes(entrypointAssetSizeTotal)}
            </td>
          </tr>
        </tbody>
      </table>
    
  )
}
github jakoblind / webpack-autoconf / src / pages / optimize.js View on Github external
'Try defining the path to your webpack.config.js file with --config ',
        'Are you using create-react-app? Then run the following commands instead:',
        <code>npm run build -- --stats</code>,
        <code>mv build/bundle-stats.json stats.json</code>,
      ]
      return {
        error: true,
        errorMessages: webpackConfigError,
        ga: {
          category: 'error',
          action: 'upload-stats',
          label: 'src not found',
        },
      }
    } else {
      const help = getDataFromStatsJson(stats)
      if (help) {
        return {
          error: false,
          help,
          ga: { category: 'optimizer', action: 'upload', label: 'ok' },
        }
      } else {
        return {
          tryChild: true,
          error: true,
          errorMessages: null,
          ga: {
            category: 'error',
            action: 'upload-stats',
            label: 'no entrypoint, assets',
          },
github jakoblind / webpack-autoconf / src / pages / optimize.js View on Github external
reader.onload = () => {
      try {
        if (_.isEmpty(reader.result)) {
          this.setState({
            error: true,
            errorMessages: ['Your stats.json file is empty'],
          })
          logToGa({
            category: 'error',
            action: 'upload-stats',
            label: 'empty stats.json file',
          })

          return
        }
        const resultTrimmed = trimJsonString(reader.result)
        const fileAsBinaryString = JSON.parse(resultTrimmed)

        const report = this.getReport(fileAsBinaryString)
        if (report.error) {
          this.setState({
            error: report.error,
            errorMessages: report.errorMessages,
          })
          logToGa(report.ga)
        } else {
          this.setState({
            error: report.error,
            errorMessages: report.errorMessages,
            help: report.help,
          })
          logToGa(report.ga)

webpack-optimize-helper

This is a JavaScript library that reads a webpack `stats.json` file and gives back useful statistics about the file that helps the dev to reduce the bundle size.

ISC
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis

Similar packages