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
const in output JS? #272
Comments
maybe I need the umd. I'll try that. |
import { Can't resolve 'gsap/umd' webpack seems to think this is a relative path. I could add node_modules/gsap to webpack so it transpiles that. But maybe you should fix the gsap package? |
So, this seems to be a solution, but let me know if you have a better idea. in webpack config.
That will transpile only node_modules/gsap and not the rest of node_modules gsap is the only package I used that includes const keyword which breaks old versions of Safari. |
@sgehrman I think you just forgot to define the class you were importing from, like: import { TweenMax, Power2 } from 'gsap/umd/TweenMax'; As for the old Safari thing, that's interesting; I didn't realize Webpack would leave ES6 stuff in there like that. Hm. Yeah, it'd be pretty easy to change those to "var" instead I guess. I can do that in the next release. But again, the UMD version should be work great for you - just define the class you're importing from. |
To embrace 'let' as much as possible, is my recommendation. It's the proper way to var, so var is just a legacy mistake, while const is equally redundant and less flexible for hot-code loading being pushed out etc. Anyway it's not absolute but what I feel instinctively is best most of the time. |
@MasterJames if one of the complaints is that old versions of Safari are choking on "const", I can't imagine "let" would be any different since it's also ES6. Plus I've read that let and const are both slower than "var" in some browsers. So my hunch is that it'd be best here to just switch it to "var". If anyone has objections, let me know. |
The performance issue was a temporary issue that is no longer a concern. There is evidence of that out there. Maybe try in your personal situation and see if it makes a significant difference for you and your code on the target platform browser etc. [ P.S. 2 less chars is let or var to const, times all declarations.] |
@MasterJames Are you suggesting that using let instead of const (or var) will solve the Safari issue mentioned above? Do you think the old version of Safari will recognize let but not const? I didn't want this thread to become about theoretical benefits of let/const over var - I'm more focused on ensuring compatibility at this point since that's such a keystone in GSAP. I do appreciate the link and suggestions though. |
I bow to your perdicament. I am off topic then agreed. |
I hear you, but I really don't want to force people to downgrade to an older version and miss out on feature enhancements and bug fixes just because of a let/const preference that's largely stylistic and totally inconsequential functionally (at least in this context). If I misunderstood and you're actually trying to say that you think using "var" here will break things for people (thus it's imperative that we use let/const), please let me know. |
Checking Usage of said browser Right okay to be clear, no what I've been saying is move forward. |
Break from 1.20.4 to 1.20.6. I need to |
@azopyros 1.20.6 doesn't have const at all, unless you're using it as a module because the package.json "module" does point to the /esm/ directory. You should be able to either avoid using it as a module or import directly from the root or even the /src/uncompressed/ directory if you prefer. Or use 1.20.4 of course. |
Yeah, that makes me cry, again. "module" pointer should point to ES5 module, which only use import/export. No arrow functions / const / let / spread and other feature is allowed. Further reading: https://github.com/rollup/rollup/wiki/pkg.module#wait-it-just-means-import-and-export--not-other-future-javascript-features Please, replace |
@azopyros @MasterJames @sgehrman guys, i've forked repo to https://github.com/glebmachine/GreenSock-JS and replaced Everything work like a charm. Made fork for yourself, or use mine. Just add to
|
Nice. Thanks. |
can we please change const to var. it's breaking our iOS 9 users on safari. |
@jackdoyle could you please? |
Absolutely. 2.0.2 should be released sometime next week. Thanks for your patience :) |
Wasn't 'let' the correct choice now. Maybe backfill it if no let found by setting let to var if it doesn't exist on some backwards incompatibility issue that should really just be forced to upgrade. |
I switched to "var" to avoid backward compatibility issues. It's released now in 2.0.2. "let" is part of ES6 just like "const" is, so that wouldn't be any better. |
Okay cool. |
Thanks for the link. |
Hey, I'm not much of a JS guy, but I've had complaints from people on old versions of Safari.
Older versions don't like const keyword.
Using webpack and const is in my build. Let me know if I did something wrong.
*!
*/
const r="undefined"!=typeof window?window:void 0!==t&&t.exports&&void 0!==i?i:{},o=function(t,e){var n={},i=t.document,r=t.GreenSockGlobals=t.GreenSockGlobals||t;if(r.TweenLite)return r.TweenLite;var o,a,s,l,c,u,p,d=function(t){var e,n=t.split("."),i=r;for(e=0;e<n.length;e++)i[n[e]]=i=i[n[e]]||{};return i},h=d("com.greensock"),f=function(t){var e,n=[],i=t.length;for(e=0;e!==i;n.push(t[e++]));return n},m=function(){},g=(u=Object.prototype.toString,p=u.call([]),function(t){return null!=t&&(t instanceof Array||"object"==typeof t&&!!t.push&&u.call(t)===p)}),b={},x=function(t,e,i,o){this.sc=b[t]?b[t].sc:[],b[t]=this,this.gsClass=null,this.func=i;var a=[];this.check=function(s){for(var l,c,u,p,h=e.length,f=h;--h>-1;)(l=b[e[h]]||new
The text was updated successfully, but these errors were encountered: