This repository was archived by the owner on Jun 16, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 222
This repository was archived by the owner on Jun 16, 2025. It is now read-only.
Next.js webpack configuration detection failed #805
Copy link
Copy link
Closed
Labels
Description
Bug Description
Nextjs webpack config related error message (not affecting the result)
Next.js webpack configuration detection failed with the following error TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:387:5)
at validateString (node:internal/validators:121:11)
at Object.join (node:path:1172:7)
at Object.newWebpackFunction [as webpack] (/***/node_modules/@sentry/nextjs/cjs/config/webpack.js:83:36)
at loadNextWebpackConfig (/***/.nvm/versions/node/v16.17.1/lib/node_modules/depcheck/dist/special/webpack.js:157:25)
at parseWebpack (/***/.nvm/versions/node/v16.17.1/lib/node_modules/depcheck/dist/special/webpack.js:187:27)
at getDependencies (/***/.nvm/versions/node/v16.17.1/lib/node_modules/depcheck/dist/check.js:71:24)
at /***/.nvm/versions/node/v16.17.1/lib/node_modules/depcheck/dist/check.js:97:32
at Array.map (<anonymous>)
at checkFile (/***/.nvm/versions/node/v16.17.1/lib/node_modules/depcheck/dist/check.js:97:18) {
code: 'ERR_INVALID_ARG_TYPE'
} Support for this feature is new and experimental, please report issues at https://github.com/depcheck/depcheck/issues
Code snippets
Where the dependency is used:
next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {}
module.exports = nextConfig
// Injected content via Sentry wizard below
const { withSentryConfig } = require("@sentry/nextjs");
module.exports = withSentryConfig(
module.exports,
{
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options
// Suppresses source map uploading logs during build
silent: true,
org: "ad346b700ab9",
project: "javascript-nextjs",
},
{
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,
// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: true,
// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
tunnelRoute: "/monitoring",
// Hides source maps from generated client bundles
hideSourceMaps: true,
// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
}
);
Where the dependency is listed in package.json:
{
"name": "workspace",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@sentry/nextjs": "^7.54.0",
"@types/node": "20.1.2",
"@types/react": "18.2.6",
"@types/react-dom": "18.2.4",
"autoprefixer": "10.4.14",
"eslint": "8.40.0",
"eslint-config-next": "13.4.4",
"next": "13.4.4",
"postcss": "8.4.23",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "3.3.2",
"typescript": "5.0.4"
}
}
Versions
node -v
: 18.14.2npm -v
: 9.5.0depcheck --version
: 1.4.3 (using npx)
Extra info
Reproduction is created using Nextjs template in Codesandbox, and running npx @sentry/wizard@latest -i nextjs
to setup Sentry for Nextjs.
Minimum reproduction: Codesandbox
sam-super and PaulRBerg