diff --git a/babel.config.js b/babel.config.js index 9ced748a9..4c2fe5682 100644 --- a/babel.config.js +++ b/babel.config.js @@ -68,7 +68,7 @@ module.exports = (api) => { plugins, overrides: [ { - test: /tesseract\.js/, + test: [/tesseract\.js/, /fuzzysort\.js/], presets: [ ['@babel/env', { ...envOptions, modules: 'commonjs' }], ], diff --git a/config/webpack/rules/babel.js b/config/webpack/rules/babel.js index c7bf886e7..902b823e1 100644 --- a/config/webpack/rules/babel.js +++ b/config/webpack/rules/babel.js @@ -2,19 +2,19 @@ const { join, resolve } = require('path'); const { env, settings } = require('../configuration'); +// Those modules contain modern ES code that need to be transpiled for Webpack to process it +const nodeModulesToProcess = [ + '@reduxjs', 'fuzzysort' +]; + module.exports = { test: /\.(js|jsx|mjs|ts|tsx)$/, include: [ settings.source_path, ...settings.resolved_paths, - 'node_modules/@reduxjs' + ...nodeModulesToProcess.map(p => resolve(`node_modules/${p}`)), ].map(p => resolve(p)), - exclude: function(modulePath) { - return ( - /node_modules/.test(modulePath) && - !/@reduxjs/.test(modulePath) - ); - }, + exclude: new RegExp('node_modules\\/(?!(' + nodeModulesToProcess.join('|')+')\\/).*'), use: [ { loader: 'babel-loader', diff --git a/package.json b/package.json index 3bbea3443..385b8fb5b 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "escape-html": "^1.0.3", "file-loader": "^6.2.0", "font-awesome": "^4.7.0", - "fuzzysort": "^2.0.4", + "fuzzysort": "^3.0.0", "glob": "^10.2.6", "history": "^4.10.1", "hoist-non-react-statics": "^3.3.2", diff --git a/yarn.lock b/yarn.lock index e32c54f71..4b22ff75e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2850,7 +2850,7 @@ __metadata: eslint-plugin-react-hooks: "npm:^4.6.0" file-loader: "npm:^6.2.0" font-awesome: "npm:^4.7.0" - fuzzysort: "npm:^2.0.4" + fuzzysort: "npm:^3.0.0" glob: "npm:^10.2.6" history: "npm:^4.10.1" hoist-non-react-statics: "npm:^3.3.2" @@ -8876,10 +8876,10 @@ __metadata: languageName: node linkType: hard -"fuzzysort@npm:^2.0.4": - version: 2.0.4 - resolution: "fuzzysort@npm:2.0.4" - checksum: 10c0/3170d16fccc0f4ac5e31323dbab7d0da7b1a4024878ed4d6b4ec86c0df94e12dc335f8d4181e38d97ca7919ac51bc5de4a9c2ec94914a4e51f9e9c05208c9ea9 +"fuzzysort@npm:^3.0.0": + version: 3.0.2 + resolution: "fuzzysort@npm:3.0.2" + checksum: 10c0/c6cdbd092a8e91ed822aeac6d4fb95559759c10602cb29f27307c1cabd01fdd384fa399f7757722435b595244efb000cd63f144104c41b8551b2faff123279cb languageName: node linkType: hard