Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

277
Views
TypeError: module.nameForCondition no es una función

Estoy usando webpack 4 splitchunk para exportar el archivo js, mi aplicación tiene 4 entradas:

 entry : { bg : './src/background-scripts/' , content : ['./src/content-scripts/firefox-fix.js', './src/content-scripts/'] , options : [ './src/options/' ], popup : './src/popup/' , 'bs-lite' : './src/public/bootstrap-lite.scss' } ,

Quiero empaquetar la popup y la entrada de content en common1.js . luego configuro el splitchunk así:

 optimization: { splitChunks: { cacheGroups: { commons1: { name: 'commons1.js', test: module => { for (const chunk of module.chunksIterable) { if (chunk.name && /(popup|content)/.test(chunk.name)) { if (module.nameForCondition() && /[\\/]node_modules[\\/]/.test(module.nameForCondition())) { return true; } } } return false; }, minChunks: 1, chunks: 'all' }, commons2: { name: 'commons2.js', chunks(chunk){ return chunk.name === 'commons1.js' || chunk.name === 'options' }, minChunks: 1, chunks: 'all' }, commons3: { name: 'commons3.js', chunks(chunk){ return chunk.name === 'bg' || chunk.name === 'commons2.js' }, minChunks: 1, chunks: 'all' }, } } },

Pero cuando ejecuto esta configuración, muestra un error como este:

 /Users/source/frontend/c/build/webpack.base.config.js:61 if (module.nameForCondition() && /[\\/]node_modules[\\/]/.test(module.nameForCondition())) { ^ TypeError: module.nameForCondition is not a function

Estoy buscando en Internet, parece que nadie enfrenta este problema. que debo hacer para arreglarlo?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!