8000 Serverless, treeshaking · Issue #8956 · vercel/next.js · GitHub
[go: up one dir, main page]

Skip to content
Serverless, treeshaking #8956
@fernandobandeira

Description

@fernandobandeira

Bug report

Describe the bug

Currently, if the next build is targeted to serverless, the resulting files don't go through tree shaking.

To Reproduce

Checkout this repo: https://github.com/fernandobandeira/next-serverless-treeshakingissue
Just install and build the project, if you inspect the resulting index.js file, you'll see that it has 1mb and contains all of the icons from font-awesome

Expected behavior

The only icon that should appear there is the one I've imported, it shouldn't include unused code.

Additional context

For me, this is resulting in each page of my app having 16mb, more than 500mb for the entire app and 120mb zipped, which makes it impossible to deploy on aws lambda.

If you remove the target to serverless, the compiled server file only includes the cofee icon, as it should.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueEasy to fix issues, good for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0