Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to ignore 'unused' dependencies in configuration file. #2336

Open
1 task done
InstantlyMoist opened this issue Apr 3, 2024 · 0 comments
Open
1 task done

Comments

@InstantlyMoist
Copy link

InstantlyMoist commented Apr 3, 2024

Describe the feature

Hi,

When using mongoose together with Nuxt 3/nitro you often run into the issue that your models are tree-shaken out of your final build. Leading to 500 errors because a reference could not be found to this file.

image

Solving it like this:

    const _ = [
        IModelA.length,
        IModelB.length,
        IModelC.length
    ]

works, but I think there has to be a cleaner solution. I'm proposing some kind of option file to allow for certain directories and/or files to be ignored from the tree-shaking logic.

Maybe like this:

nitro: {
    dontShake: [
        './models/**'
        './important_file.ts'
    ]
}

Additional information

  • Would you be willing to help implement this feature?

Yes, but someone would have to give me a starting point, as I'm not familair with the internals of nitro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant