{"record":{"id":"82676ef4660b18cb","repo":"gatsbyjs/gatsby","slug":"encountered-unknown-module-type-module-type-p","errorCode":null,"errorMessage":"Encountered unknown module type: ${module.type}. Please open an issue.","messagePattern":"Encountered unknown module type: (.+?)\\. Please open an issue\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/gatsby/src/utils/webpack.config.js","lineNumber":694,"sourceCode":"            return FRAMEWORK_BUNDLES_REGEX.test(module.nameForCondition())\n          },\n          priority: 40,\n          // Don't let webpack eliminate this chunk (prevents this chunk from becoming a part of the commons chunk)\n          enforce: true,\n        },\n        // if a module is bigger than 160kb from node_modules we make a separate chunk for it\n        lib: {\n          test(module) {\n            return (\n              !isCssModule(module) &&\n              module.size() > 160000 &&\n              /node_modules[/\\\\]/.test(module.identifier())\n            )\n          },\n          name(module) {\n            const hash = crypto.createHash(`sha1`)\n            if (!module.libIdent) {\n              throw new Error(\n                `Encountered unknown module type: ${module.type}. Please open an issue.`\n              )\n            }\n\n            hash.update(module.libIdent({ context: program.directory }))\n\n            return hash.digest(`hex`).substring(0, 8)\n          },\n          priority: 30,\n          minChunks: 1,\n          reuseExistingChunk: true,\n        },\n        commons: {\n          name: `commons`,\n          // if a chunk is used on all components we put it in commons (we need at least 2 components)\n          minChunks: Math.max(componentsCount, 2),\n          priority: 20,\n        },","sourceCodeStart":676,"sourceCodeEnd":712,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/8b06340921ffdf23125a365b9c9923690cb62ce6/packages/gatsby/src/utils/webpack.config.js#L676-L712","documentation":"Thrown from the webpack splitChunks `lib.name` callback when a module that passes the lib-chunk test (>160kb, from node_modules, not CSS) has no `libIdent` method. `libIdent` produces a stable, context-relative identifier used to hash the chunk name; some webpack 5 module types (e.g. raw/asset/external modules) do not implement it. Gatsby treats this as an internal invariant and asks the user to file an issue.","triggerScenarios":"A dependency in `node_modules` larger than 160kb ships a module type for which webpack does not provide `libIdent` (e.g. an asset/data/native module surfaced through a loader chain). The `name` callback is invoked during chunk optimization and the guard trips.","commonSituations":"Adding a heavy dependency (WASM, large data files, native bindings) whose webpack module type lacks `libIdent`; upgrading webpack-related Gatsby internals or a loader that changes the emitted module type; very rarely hit, typically indicates a loader/bundler edge case.","solutions":["Identify the large dependency (>160kb) recently added and check whether it ships asset/WASM modules.","Update Gatsby, webpack, and relevant loaders to their latest compatible versions.","If reproducible, file the issue requested in the message with the dependency list and module.type.","As a temporary workaround, configure `splitChunks` overrides via `gatsby-node.js` `onCreateWebpackConfig` to exclude the offending module from the lib chunk."],"exampleFix":"// gatsby-node.js workaround: exclude asset modules from lib chunk\nexports.onCreateWebpackConfig = ({ stage, actions, getConfig }) => {\n  const config = getConfig()\n  if (config.optimization && config.optimization.splitChunks) {\n    const lib = config.optimization.splitChunks.cacheSets?.lib || config.optimization.splitChunks.cacheGroups?.lib\n    if (lib && lib.test) {\n      const orig = lib.test\n      lib.test = (module) => orig(module) && module.libIdent !== undefined\n    }\n  }\n  actions.replaceWebpackConfig(config)\n}","handlingStrategy":"try-catch","validationCode":"// Defensive name callback that skips modules without libIdent\nname(module) {\n  if (!module.libIdent) return 'fallback-chunk'\n  const hash = crypto.createHash('sha1')\n  hash.update(module.libIdent({ context: program.directory }))\n  return hash.digest('hex').substring(0, 8)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep webpack, loaders, and Gatsby on compatible versions.","Audit heavy dependencies (>160kb) that ship asset/WASM modules.","Report the module.type to Gatsby if reproducible."],"tags":["webpack","split-chunks","build","node-modules","internal"],"backgroundTag":null,"analyzedSha":"8b06340921ffdf23125a365b9c9923690cb62ce6","analyzedAt":"2026-08-13T02:36:21.405Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}