question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

lodash-es explodes with Next.js

See original GitHub issue

Please make sure you have read the submission guidelines before posting an issue

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • I am running the latest version
  • I checked the documentation (nx.dev) and found no answer
  • I checked to make sure that this issue has not already been filed
  • I’m reporting the issue to the correct repository (not related to React, Angular or any dependency)

Expected Behavior

Be able to use lodash-es in my Next.js app

Current Behavior

Errors

Failure Logs

/project/node_modules/lodash-es/lodash.js:10
export { default as add } from './add.js';
^^^^^^

SyntaxError: Unexpected token 'export'
    at Module._compile (internal/modules/cjs/loader.js:892:18)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at Module.require (/project/node_modules/@nrwl/tao/src/compat/compat.js:4:36)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.lodash-es (/project/dist/apps/core/server/static/development/pages/_app.js:4311:18)
    at __webpack_require__ (/project/dist/apps/core/server/static/development/pages/_app.js:23:31)
    at Module.../../libs/hooks/src/lib/useId/useId.ts (/project/dist/apps/core/server/static/development/pages/_app.js:418:67)
    at __webpack_require__ (/project/dist/apps/core/server/static/development/pages/_app.js:23:31)
    at Module.../../libs/hooks/src/lib/useId/index.ts (/project/dist/apps/core/server/static/development/pages/_app.js:394:64)
    at __webpack_require__ (/project/dist/apps/core/server/static/development/pages/_app.js:23:31)
    at Module.../../libs/hooks/src/index.ts (/project/dist/apps/core/server/static/development/pages/_app.js:291:68)
    at __webpack_require__ (/project/dist/apps/core/server/static/development/pages/_app.js:23:31)
    at Module../hoc/withAuthSync.tsx (/project/dist/apps/core/server/static/development/pages/_app.js:3624:73)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
DaSchTourcommented, May 18, 2021

I hope there is some other solution. It’s pretty ugly to have to switch between lodash and lodash-es between different projects and it also eliminates the possibility to use lodash inside a library that is shared between server and client.

Especially as it works correctly with nest js CLI

0reactions
dsebastiencommented, Mar 2, 2020

I’ve stumbled on the same issue with NestJS. I assume that the same recommendation to use lodash and not lodash-es holds there as well?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Next.js bundle size is exploding as a result of dynamic ...
PROBLEM. TLDR: Next's Webpack configuration is chunking dynamically loaded components as its own chunk, which may create duplicated or ...
Read more >
Lodash _.explode() Method - GeeksforGeeks
The Lodash _.explode() method is used to explode a string into an array of characters. Syntax: _.explode( String );. Parameters: This method ...
Read more >
An Inconsistent Truth: Next.js and Typesafety - Hacker News
We try to avoid this transitive dependency explosion nonsense alltogether. Even well known libraries like lodash, which are not typescript ...
Read more >
React Next js Pagination using Lodash - YouTube
Learn how to Get data From server API in React Next. js app and Paginate data using lodash also learn some crud operation...
Read more >
Playground | FastStore
stylelint.config.js. tsconfig.json ... nextjs-progressbar^0.0.14 ... dependencies:\n \"@babel\u002Fhelper-explode-assignable-expression\" \"^7.16.7\"\n ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found