Estoy tratando de configurar el paquete webpack-subresource-integrity en mi config-overrides.js ( react-app-rewired ):
const { SubresourceIntegrityPlugin } = require('webpack-subresource-integrity'); module.exports = function override(config, env) { config.optimization.splitChunks.cacheGroups = { ...config.optimization.splitChunks.cacheGroups, project: { test: /[\\/]node_modules[\\/]@project[\\/]/ } }; // added this part config.output = { crossOriginLoading: 'anonymous' }; config.plugins = [...config.plugins, new SubresourceIntegrityPlugin()]; return config; }; Obtengo TypeError: Cannot read property 'tap' of undefined
Ya intenté eliminar mis node_modules, yarn.lock y luego reinstalar los paquetes, pero sigo teniendo el mismo error.
Este es el error completo:
/Users/me/myProject/node_modules/react-scripts/scripts/start.js:19 throw err; ^ TypeError: Cannot read property 'tap' of undefined at /Users/me/myProject/node_modules/webpack-subresource-integrity/index.js:235:48 at SyncHook.eval [as call] (eval at create (/Users/me/myProject/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:89:1) at SyncHook.lazyCompileHook (/Users/me/myProject/node_modules/tapable/lib/Hook.js:154:20) at Compiler.newCompilation (/Users/me/myProject/node_modules/webpack/lib/Compiler.js:631:26) at /Users/me/myProject/node_modules/webpack/lib/Compiler.js:667:29 at _next0 (eval at create (/Users/me/myProject/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1) at eval (eval at create (/Users/me/myProject/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:26:1) at processTicksAndRejections (internal/process/task_queues.js:95:5) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.Tengo una solución para que funcione bien, siga el siguiente paso: