wrap-cli icon indicating copy to clipboard operation
wrap-cli copied to clipboard

JavaScript minimization (aka "minification")

Open krisbitney opened this issue 3 years ago • 2 comments

JavaScript minimization (aka "minification") issues have been encountered in both the Uniswap v3 front end demo and the Polywrap Hub. For example, in the Polywrap Hub, class names were being erased during optimization and this was fixed by configuring Webpack. We should ensure our JavaScript packages comply with minimization standards/requirements so that minimization works without requiring users to modify Webpack settings.

krisbitney avatar Jun 28 '22 16:06 krisbitney

Can we do some research on:

  • reproducing these minifcation errors (branch links w/ repro steps)
  • what are some common issues with minification in production are (removing class names for example)
  • where in our code are these issue stemming from?

dOrgJelli avatar Jun 29 '22 07:06 dOrgJelli

reproducing these minifcation errors (branch links w/ repro steps)

  • Go to demos repository & checkout to branch update-hello-world-to-origin (PR: https://github.com/polywrap/demos/pull/70)
  • In ts-vanilla app, go to the webpack.config.js file and change (in line 5) mode to production
  • Run the app and try to run the invocation - it should fail

where in our code are these issue stemming from?

Based on @Brioline report of the bug, it looks like the Uri class might be a problem regarding minification. My first thought is that it is something with the getters but not sure... image

Also, it's worth mentioning that I fixed this with the keep function & class names in minification (https://github.com/polywrap/polyfolio/pull/150/files)

cbrzn avatar Jul 14 '22 14:07 cbrzn