Skip to content

Module not found: Can't resolve 'lodash.throttle' #584

Description

@ackledotdev

Next throws an error about not being able to find lodash.throttle. I've tried installing that package manually, but the same thing happens.
Steps to reproduce: create a quick Next app with react-scroll and use the Link component and scrollSpy function appropriately.

Next.js logs:

⨯ ./node_modules/react-scroll/modules/mixins/scroll-spy.js:7:1
Module not found: Can't resolve 'lodash.throttle'
   5 | });
   6 |
>  7 | var _lodash = require('lodash.throttle');
     | ^
   8 |
   9 | var _lodash2 = _interopRequireDefault(_lodash);
  10 |

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/react-scroll/modules/index.js
./src/components/scroll/ScrollLink.tsx
./src/app/page.tsx

tsconfig.json:

{
	"compilerOptions": {
		"lib": ["dom", "esnext"],
		"skipLibCheck": true,
		"strict": true,
		"noEmit": true,
		"esModuleInterop": true,
		"module": "esnext",
		"moduleResolution": "bundler",
		"resolveJsonModule": true,
		"isolatedModules": true,
		"jsx": "preserve",
		"incremental": true,
		"plugins": [
			{
				"name": "next"
			}
		],
		"paths": {
			"@/*": ["./src/*"],
			"@ui/*": ["./src/components/ui/*"]
		},
		"target": "esnext"
	},
	"include": [
		"next-env.d.ts",
		"**/*.ts",
		"**/*.tsx",
		".next/types/**/*.ts",
		"next.config.js"
	],
	"exclude": ["node_modules"]
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions