okikio / bundlejs

An online tool to quickly bundle & minify your projects, while viewing the compressed gzip/brotli bundle size, all running locally on your browser.
https://bundlejs.com
MIT License
787 stars 14 forks source link

Don't overwrite URL queries with sharable link when clicking 'Run' #11

Closed dpschen closed 2 years ago

dpschen commented 2 years ago

When you use search queries like they get overwritten when you click 'Run'.

https://bundle.js.org/?q=react,react-dom,vue,@okikio/animate&treeshake=[*],[*],[*],[Animate,toStr]

If would be cool if the share query would instead just be added so that it's still possible to edit the query. E.g. like this:

https://bundle.js.org/?q=react,react-dom,vue,@okikio/animate&treeshake=[*],[*],[*],[Animate,toStr]&share=PTAEGEBsEsGMGtQCUCuA7UAzA9gJ1AC4AWApqAELoAmkJVoA1KALLRrSbR2OgDiAXtAAOQ7kICGCcQHMyAZ2j8SAKBIAPIXgKgAVFlzYAtqABEuEpIImA3Ko1bd+o6fOWAtFSM27m3Nr2YBsYmAG4oJN7qvtoA3qAAguyG4gQkADSE2ADKBPgAvk7BAALY8NBl2MDiSSkR1kA

okikio commented 2 years ago

It's possible, but if a user delete one of the exports, that might cause some problems with the share url, as it wouldn't be up to date

dpschen commented 2 years ago

Maybe it's possible to keep the url until the user makes a change in the textarea. That way it's possible to modify a query url until one is happy with it.

As a workaround I currently use the bundle parameter so that I don't have to press the run button:

https://bundle.js.org/?bundle&q=react,react-dom,vue,@okikio/animate&treeshake=[*],[*],[*],[Animate,toStr]

The resulting application state is the same as the second url (obviously different url).

okikio commented 2 years ago

This issue should now be fixed, try it, and tell me what you think

dpschen commented 2 years ago

Seems to work =)

Only the old urls seem to be broken:

https://bundle.js.org/?q=react,react-dom,vue,@okikio/animate&treeshake=[*],[*],[*],[Animate,toStr]

But I guess that's not super important.

okikio commented 2 years ago

Yeah I had to updated how treeshakeable urls worked, the new format is this https://bundle.js.org/?q=react,react-dom,vue,@okikio/animate&treeshake=[*],[*],[*],[{Animate,toStr}]

it's not to different