NextJS serverless page has dependencies even though it shouldn't

Viewed 197

NextJS claims that with serverless target in next.config.js...

module.exports = {
    target: "serverless"
}

... each page in the pages directory is output as a standalone lambda with 0 dependencies.

However, with a simple NextJS project containing a file /pages/Home.js:

export async function getServerSideProps(ctx) {

    const user = "user";
    return {props: {user}}
}

export default function Home({user}) {

    return (
        <div>
            <p>{user}</p>
        </div>
    );
}

... I end up with a file .next/serverless/pages/Home.js that still has dependencies in .next/serverless/chunks directory and that can't be used as a standalone function with a signature like a NodeJS http server callback.

Is this expected or am I doing something wrong?

0 Answers
Related