If I only use a package inside of getStaticProps
will it be included in the browser's bundle?
#14568
Answered
by
Timer
ricokahler
asked this question in
Help
-
If I only use a package inside of e.g. import someLargePackage from 'some-large-package';
export async function getStaticProps(context) {
const something = await someLargePackage(context.params?.slug);
return {
props: { something },
}
}
// ... This some-large-package is really only needed during build time. I'm curious if next knows how to remove it from browser bundle. Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
Timer
Jun 25, 2020
Replies: 1 comment 2 replies
-
This will not be in the browser bundle: You can put your code in this to verify: |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
ricokahler
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will not be in the browser bundle:
https://nextjs.org/docs/basic-features/data-fetching#write-server-side-code-directly
You can put your code in this to verify:
https://next-code-elimination.now.sh/