Skip to content
Discussion options

You must be logged in to vote

So like, here the issue is that you got away with it on webpack. Away with what? Importing server side code into the client.

I know that, often this can be out of your control, you need a util, or whatever from a library out of your control, and simply importing it into your client code, indirectly imports fs or any other Node.js module, but it is important to try and keep these separate.

Anyway, you can try this:

import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  /* config options here */
  turbopack: {
    resolveAlias: {
      'fs': {
        browser: './src/lib/empty.ts'
      }
    }
  }
};

export default nextConfig;

Then I have a src/lib/empty.ts file (I am…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Kumneger0
Comment options

You must be logged in to vote
3 replies
@icyJoseph
Comment options

@Kumneger0
Comment options

@icyJoseph
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants