chunk.sortModules is not a function when running yarn run encore production in symfony project

i Just run $yarn run encore production

i have this error:

TypeError: chunk.sortModules is not a function
at /var/www/ppd2_orientation-paysdelaloire_f/livraisons/symfony/node_modules/@symfony/webpack-encore/node_modules/extract-text-webpack-plugin/dist/index.js:188:19

My package.json file:

   {
        "devDependencies": {
        "@babel/cli": "^7.25.7",
       "@babel/core": "^7.25.8",
       "@babel/preset-env": "^7.25.8",
       "@fortawesome/fontawesome-free": "^5.2.0",
       "@symfony/webpack-encore": "^0.20.1",
       "webpack": "^2.7.0"
   },
    "license": "UNLICENSED",
    "private": true,
    "scripts": {
        "dev-server": "encore dev-server",
        "dev": "encore dev",
        "watch": "encore dev --watch",
        "build": "encore production"
    },
    "dependencies": {
        "@babel/polyfill": "^7.0.0",
        "autocomplete.js": "^0.31.0",
        "babel": "^6.23.0",
        "babel-core": "^6.26.3",
        "babel-loader": "7",
        "babel-preset-env": "^1.7.0",
        "babel-preset-stage-3": "^6.24.1",
        "canvg": "^1.5.3",
        "foundation-sites": "6.5.3",
        "highcharts": "^6.1.1",
        "instantsearch.js": "^2.10.*",
        "jquery-validation": "^1.18.0",
        "leaflet": "^1.3.4",
        "leaflet-omnivore": "^0.3.4",
        "leaflet.markercluster": "^1.4.1",
        "moment": "^2.22.2",
        "motion-ui": "^2.0.3",
        "mustache": "^3.0.1",
        "npm": "^6.1.0",
        "ol": "^5.2.0",
        "select2": "^4.1.0-rc.0",
        "slick-carousel": "^1.8.1",
        "svgtodatauri": "^0.0.0",
        "webpack-jquery-ui": "^1.0.0",
        "yarn": "^1.21.0"
    }
}

my webpack.config.js file:

var Encore = require('@symfony/webpack-encore');

Encore
// the project directory where all compiled assets will be stored
.setOutputPath('public/build/')

// the public path used by the web server to access the previous directory
.setPublicPath('/build')

// will create public/build/app.js and public/build/app.css
.addEntry('app', './assets/js/app.js')

// allow legacy applications to use $/jQuery as a global variable
.autoProvidejQuery()

// enable source maps during development
.enableSourceMaps(!Encore.isProduction())

// empty the outputPath dir before each build
.cleanupOutputBeforeBuild()

.configureBabel(function(babelConfig) {
    // add additional presets
    babelConfig.presets.push('stage-3');
    babelConfig.presets.push('env');

    // no plugins are added by default, but you can add some
    // babelConfig.plugins.push('styled-jsx/babel');
})

// create hashed filenames (e.g. app.abc123.css)
// .enableVersioning()

// allow sass/scss files to be processed
// .enableSassLoader()
;

// export the final configuration
module.exports = Encore.getWebpackConfig();

thank you for your help