Configuration has an unknown property 'optimization'

configuration has an unknown property "optimization"
my project has been unable to run. Other people in the company can. I would like to ask why. I suspect that the version of webpack is wrong, but it is "webpack": "^ 4.23.1" in package.json. I don"t know how to solve it. I hope a boss can help solve it

.
Jul.10,2022

webpack paste the related configuration


optimization: {
    splitChunks: {
      cacheGroups: {
        commons: {
          test: /[\\/]node_modules[\\/]/,
          // cacheGroupKey here is `commons` as the key of the cacheGroup
          name(module, chunks, cacheGroupKey) {
            const moduleFileName = module.identifier().split('/').reduceRight(item => item);
            const allChunksNames = chunks.map((item) => item.name).join('~');
            return `${cacheGroupKey}-${allChunksNames}-${moduleFileName}`;
          },
          chunks: 'all'
        }
      }
    }
  }
Menu