Skip to content

Invalid hashes of commons chunks because hash is not generated from purgecss result #40

@StarpTech

Description

@StarpTech

@lucleray I don't know if it's related to next-compose-plugins but when I use this plugin the hash of the generated common chunks is wrong.

module.exports = withPlugins(
  [
    withCSS,
    [
      withSass,
      {
        sassLoaderOptions: {
          includePaths: ['../../node_modules', 'node_modules', 'styles']
        }
      }
    ],
    [
      optional(() => withPurgeCss),
      {
        purgeCssPaths: ['pages/**/*', 'components/**/*', 'layouts/**/*'],
        purgeCss: {
          whitelist: ['__next']
        }
      },
      [PHASE_PRODUCTION_BUILD]
    ]
  ]
)

Reproduce

  1. Use a class like pt-xl-4 in exact one component. PurgeCss will include it because it's used. The hash of the file is something like .next/static/chunks/commons.d4d0b807.chunk.css.
  2. Remove the class pt-xl-4 in the component and rebuild. You will see the hash hasn't changed but the class was removed by PurgeCss.

That's an indication that hash was generated on the content before purgecss proceed it.

We removed it completely from the build because it was the cause of several production cache issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions