bundlesize icon indicating copy to clipboard operation
bundlesize copied to clipboard

Support for codesandbox

Open meetzaveri opened this issue 5 years ago • 12 comments

Do you want to request a feature or report a bug? Actually if there is an existing feature, then how should it be accessed to perform test on codesandbox

What is the current behavior? Perform testing in codesandbox is an ease way better than running npm server on local machine.

If the current behavior is a bug, please provide the steps to reproduce. Not sure about if it's a bug

What is the expected behavior? A way to check bundlesize for particular codesandbox

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information.

  • node version (Codesandbox version)
  • npm version (Codesandbox version)
  • Operating system (Codesandbox Web)
  • bundlesize version (Latest version)
  • CI you are using (None)

meetzaveri avatar Aug 12 '19 09:08 meetzaveri

Can you describe your workflow you have now, and how you'd like to see bundlesize as part of it? I'm not exactly sure what is missing now.

Do you want to see the final bundle size of a site you make on code sandbox which never ends up on GitHub?

Haroenv avatar Aug 12 '19 11:08 Haroenv

Do you want to see the final bundle size of a site you make on code sandbox which never ends up on GitHub?

Yes I need to see final bundle size of my app in codesandbox. Yeah its not on github nor I have connected it to github.

I have simple App built in codesandbox. After installing bundlesize, I followed steps included in documentation. But that clearly states that if you are building app on local machine as if by doing npm start. But here the scenario is where codesandbox automatically runs scripts for us.

So how to run manual script for bundlesize in codesandbox environment ? Is there a way ? Or I can only perform tests while running server locally ?

meetzaveri avatar Aug 13 '19 03:08 meetzaveri

Ah, I understand your question now. When you're using the default react starter (create-react-app) on codesandbox, you don't have access to the terminal.

I haven't tried this but I think wrapping it in a test might just work (the default starter let's you run tests with jest)

This isn't a core part of bundlesize's capabilities but I'd be keen to find a not-so-annoying workaround that works with online editors like codesandbox and glitch.

siddharthkp avatar Aug 13 '19 04:08 siddharthkp

Ah, I understand your question now. When you're using the default react starter (create-react-app) on codesandbox, you don't have access to the terminal.

Yes exactly. I need an interface to run script (CLI probably).

Okay, so let me check wrapping test in jest. Haven't explored a jest yet.

If you want to see sandbox, here's the link - https://codesandbox.io/embed/competent-chaplygin-ir9im

meetzaveri avatar Aug 13 '19 05:08 meetzaveri

Note that codesandbox exclusively works in development mode, and doesn’t have an option to run in production mode, unless deployed to now or netlify. Where and when do you want to see the bundlesize output preferably ?

Haroenv avatar Aug 13 '19 06:08 Haroenv

Specifically in development mode

On Tue, Aug 13, 2019, 12:22 PM Haroen Viaene [email protected] wrote:

Note that codesandbox exclusively works in development mode, and doesn’t have an option to run in production mode, unless deployed to now or netlify. Where and when do you want to see the bundlesize output preferably ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/siddharthkp/bundlesize/issues/331?email_source=notifications&email_token=AFCOP6BL7SCM6TSI3K6A65TQEJK2PA5CNFSM4IK7OQI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4EXBLA#issuecomment-520712364, or mute the thread https://github.com/notifications/unsubscribe-auth/AFCOP6CBHJHCRHYBEOHJDZLQEJK2PANCNFSM4IK7OQIQ .

meetzaveri avatar Aug 13 '19 06:08 meetzaveri

Specifically in development mode

That's probably not what you'd want to measure? The dev build has a bunch of things that you wouldn't ship to users, so the size of that bundle isn't very useful

siddharthkp avatar Aug 13 '19 07:08 siddharthkp

Yeah you're right. I got into misconception. Actually I need to check it into production mode. But is it necessary that I can only check it into production mode ? Can I aswell check into dev mode ?

meetzaveri avatar Aug 13 '19 07:08 meetzaveri

But is it necessary that I can only check it into production mode ? Can I aswell check into dev mode ?

bundlesize doesn't care as long as there is a persistent file, but again, I don't think that's of any use

siddharthkp avatar Aug 13 '19 07:08 siddharthkp

Okay agreed. So what steps should I perform to check bundlesize for prod build in codesandbox ?

meetzaveri avatar Aug 13 '19 08:08 meetzaveri

My point earlier was that, codesandbox does not make a prod build, and thus it might not make sense to measure the output size there at all

Haroenv avatar Aug 13 '19 08:08 Haroenv

Okay. So it's like outer from scope of bundlesize capabilities ?

meetzaveri avatar Aug 13 '19 14:08 meetzaveri