{"id":"eb1f4cce6c38b4d5","repo":"webpack/webpack","slug":"javascriptmodulesplugin-error-javascriptmodulespl","errorCode":null,"errorMessage":"JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().renderContent plugins should return something","messagePattern":"JavascriptModulesPlugin error: JavascriptModulesPlugin\\.getCompilationHooks\\(\\)\\.renderContent plugins should return something","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/javascript/JavascriptModulesPlugin.js","lineNumber":1070,"sourceCode":"\t\t\t\tchunkRenderContext,\n\t\t\t\tregistryModules,\n\t\t\t\t(module, renderInObject) =>\n\t\t\t\t\tthis.renderModule(\n\t\t\t\t\t\tmodule,\n\t\t\t\t\t\t{ ...chunkRenderContext, factory: true, renderInObject },\n\t\t\t\t\t\thooks\n\t\t\t\t\t)\n\t\t\t) || new RawSource(\"{}\");\n\t\tlet source = tryRunOrWebpackError(\n\t\t\t() => hooks.renderChunk.call(moduleSources, chunkRenderContext),\n\t\t\t\"JavascriptModulesPlugin.getCompilationHooks().renderChunk\"\n\t\t);\n\t\tsource = tryRunOrWebpackError(\n\t\t\t() => hooks.renderContent.call(source, chunkRenderContext),\n\t\t\t\"JavascriptModulesPlugin.getCompilationHooks().renderContent\"\n\t\t);\n\t\tif (!source) {\n\t\t\tthrow new Error(\n\t\t\t\t\"JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().renderContent plugins should return something\"\n\t\t\t);\n\t\t}\n\t\tsource = InitFragment.addToSource(\n\t\t\tsource,\n\t\t\tchunkRenderContext.chunkInitFragments,\n\t\t\tchunkRenderContext\n\t\t);\n\t\tsource = tryRunOrWebpackError(\n\t\t\t() => hooks.render.call(source, chunkRenderContext),\n\t\t\t\"JavascriptModulesPlugin.getCompilationHooks().render\"\n\t\t);\n\t\tif (!source) {\n\t\t\tthrow new Error(\n\t\t\t\t\"JavascriptModulesPlugin error: JavascriptModulesPlugin.getCompilationHooks().render plugins should return something\"\n\t\t\t);\n\t\t}\n\t\tchunk.rendered = true;","sourceCodeStart":1052,"sourceCodeEnd":1088,"githubUrl":"https://github.com/webpack/webpack/blob/318421ea8ac81371f5171236a6efb63675576528/lib/javascript/JavascriptModulesPlugin.js#L1052-L1088","documentation":"Thrown during renderChunk (the non-entry chunk render path in JavascriptModulesPlugin) when the renderContent SyncWaterfallHook returns a falsy value after being called. The hook chains plugin outputs; if the last plugin to tap returns null/undefined (and no plugin returned a valid Source), the post-hook check throws.","triggerScenarios":"A plugin tapping JavascriptModulesPlugin.getCompilationHooks().renderContent for a non-entry chunk returns null, undefined, or an empty string instead of a Source object, and no other plugin in the chain provides a valid Source.","commonSituations":"Custom render plugins (minification wrappers, source transform plugins) that conditionally return nothing; a plugin authored for entry chunks only that inadvertently taps renderContent for all chunks; version incompatibility where a plugin's render logic changed.","solutions":["Ensure your renderContent tap always returns a Source (or the input source unchanged) — never null or undefined.","Return the incoming `source` argument as a pass-through when your plugin has no transformation to apply.","Audit all plugins tapping renderContent to find which one returns falsy for the failing chunk.","If a third-party plugin is responsible, check for an updated version compatible with your webpack major."],"exampleFix":"// before\nhooks.renderContent.tap('MyPlugin', (source, ctx) => {\n  return transformOrNull(source); // may return null\n});\n// after\nhooks.renderContent.tap('MyPlugin', (source, ctx) => {\n  return transformOrNull(source) || source;\n});","handlingStrategy":"validation","validationCode":"// When tapping renderContent, always guarantee a return\nhooks.renderContent.tap('MyPlugin', (source, ctx) => {\n  const result = myTransform(source);\n  return result !== null && result !== undefined ? result : source;\n});","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always return a Source from renderContent taps.","Use `return source;` as the default fallback in taps.","Test plugins against both entry and non-entry chunks."],"tags":["render","chunk","plugin","code-generation"],"analyzedSha":"318421ea8ac81371f5171236a6efb63675576528","analyzedAt":"2026-08-03T19:39:56.731Z","schemaVersion":2}