You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a project, where I've split some logic into a separate package. As it is conventional, inside that separate project I export all components and utilities through the main entry file, so I can have clean imports on my nextjs project again.
Now I have some utils inside my splitted package, which use the node package "fs" for instance. This will cause a build error, even though I never import the said util into client-side components or pages from my project.
My util is only used inside the getStaticProps and Paths methods, which is okay since node packages are available inside those.
The current workaround I'm using was to move the utils which rely on node packages into a separate file, so webpack will never go there form the nextjs project.
This forces me to have some rather "ugly" imports through a build folder, since I'm working with typescript.
It would be nice if nextjs would not detect methods which work with node packages, unless they are getting imported.
This discussion was converted from issue #12106 on May 25, 2020 14:09.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on a project, where I've split some logic into a separate package. As it is conventional, inside that separate project I export all components and utilities through the main entry file, so I can have clean imports on my nextjs project again.
Now I have some utils inside my splitted package, which use the node package "fs" for instance. This will cause a build error, even though I never import the said util into client-side components or pages from my project.
My util is only used inside the getStaticProps and Paths methods, which is okay since node packages are available inside those.
The current workaround I'm using was to move the utils which rely on node packages into a separate file, so webpack will never go there form the nextjs project.
This forces me to have some rather "ugly" imports through a build folder, since I'm working with typescript.
It would be nice if nextjs would not detect methods which work with node packages, unless they are getting imported.
Beta Was this translation helpful? Give feedback.
All reactions