{"record":{"id":"3e20961f469595d9","repo":"angular/angular-cli","slug":"webpack-configuration-file-configpath-does-not","errorCode":null,"errorMessage":"Webpack configuration file ${configPath} does not exist.","messagePattern":"Webpack configuration file (.+?) does not exist\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/build_webpack/src/utils.ts","lineNumber":60,"sourceCode":"    }\n  }\n\n  // add all other files\n  for (const file of Object.keys(compilation.assets)) {\n    // Chunk files have already been added to the files list above\n    if (chunkFileNames.has(file)) {\n      continue;\n    }\n\n    files.push({ file, extension: path.extname(file), initial: false, asset: true });\n  }\n\n  return files;\n}\n\nexport async function getWebpackConfig(configPath: string): Promise<Configuration> {\n  if (!existsSync(configPath)) {\n    throw new Error(`Webpack configuration file ${configPath} does not exist.`);\n  }\n\n  const config = await import(configPath);\n\n  return 'default' in config ? config.default : config;\n}\n","sourceCodeStart":42,"sourceCodeEnd":67,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/build_webpack/src/utils.ts#L42-L67","documentation":"getWebpackConfig loads a custom webpack configuration file given by path. If the file does not exist on disk (existsSync check fails), the build stops with this error instead of silently building with defaults. It guarantees an explicitly configured webpack config must actually be present and loadable.","triggerScenarios":"Passing a webpackConfigPath (customWebpackConfig.path in build_webpack usage) that doesn't exist: typoed filename, relative path not resolved from the expected working directory, or file deleted/renamed.","commonSituations":"angular.json or custom builder options referencing 'webpack.config.js' that lives in a different directory than assumed, monorepo setups where the config is per-package and the path is relative to workspace root not project root, CI checkouts excluding the config file (e.g. .gitignore or sparse checkout).","solutions":["Correct the path in your builder options so it points at the existing webpack config file","Use an absolute path (path.resolve(__dirname, 'webpack.config.js')) or verify what directory the path is resolved from","Create the missing webpack config file if it was never committed; ensure it isn't gitignored or excluded in CI"],"exampleFix":"// before\n\"customWebpackConfig\": { \"path\": \"webpack.config.js\" }  // file lives at apps/my-app/webpack.config.js\n// after\n\"customWebpackConfig\": { \"path\": \"apps/my-app/webpack.config.js\" }","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nimport { resolve } from 'path';\nconst abs = resolve(workspaceRoot, configPath);\nif (!existsSync(abs)) {\n  throw new Error(`Webpack configuration file ${abs} does not exist. Check customWebpackConfig.path relative to ${workspaceRoot}.`);\n}","typeGuard":"null","tryCatchPattern":"try {\n  const cfg = await getWebpackConfig(configPath);\n} catch (e) {\n  if ((e as Error).message.includes('does not exist')) {\n    // log the resolved absolute path and the workspace root to debug path resolution\n  }\n  throw e;\n}","preventionTips":["Store webpack config paths relative to the workspace root and document that convention","Commit the webpack config; never list it in .gitignore","Resolve to absolute paths in shared build scripts before passing options","Smoke-test custom webpack config loading in CI before full builds"],"tags":["webpack","configuration","file-not-found"],"backgroundTag":"config-file-not-found","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}