You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe fixing this could provide a bit of a boost to everyone's build times. Today all class properties are transpiled to a time when class properties were not implemented in the browser).
🔬 Minimal Reproduction
ember new my-app
cd my-app
remove safari from targets, leaving only last 1 Chrome versions and last 1 firefox versions
add browserslist to package.json
add browserslist as devDependency
yarn browserslist --update-db
run ember build -e production
in the my-app.js, I expect all occurrences of rootURL to be involved in an assignment, rather than a function call.
This is correct.
But when I add that input file to ember, I get this for the output:
/home/nullvoxpopuli/Development/tmp/my-app/my-app/input.js: Class private methods are not enabled.
2 | #a = 'hi';
3 |
> 4 | get #b() {
| ^
5 | return 'hello' + this.#a;
6 | }
7 |
which... I guess is unrelated, but should still be fixed. Now, If I change the private methods/getters to public:
I get this mess:
vare,t,rfunctionn(e,t,r){(function(e,t){if(t.has(e))thrownewTypeError("Cannot initialize the same private elements twice on an object")})(e,t),t.set(e,r)}functioni(e,t){varr=function(e,t,r){if(!t.has(e))thrownewTypeError("attempted to "+r+" private field on non-instance")returnt.get(e)}(e,t,"get")returnfunction(e,t){if(t.get)returnt.get.call(e)returnt.value}(e,r)}r=newWeakMap,e=class{constructor(){vare,i,a,ln(this,r,{writable: !0,value: "hi"}),e=this,i="g",l=this,(a=t)&&Object.defineProperty(e,i,{enumerable: a.enumerable,configurable: a.configurable,writable: a.writable,value: a.initializer ? a.initializer.call(l) : void0})}getb(){return"hello"+i(this,r)}getc(){returnthis.b}},a=e.prototype,l="g",o=[f],u={configurable: !0,enumerable: !0,writable: !0,initializer: null},p={},Object.keys(u).forEach((function(e){p[e]=u[e]})),p.enumerable=!!p.enumerable,p.configurable=!!p.configurable,("value"inp||p.initializer)&&(p.writable=!0),p=o.slice().reverse().reduce((function(e,t){returnt(a,l,e)||e}),p),d&&void0!==p.initializer&&(p.value=p.initializer ? p.initializer.call(d) : void0,p.initializer=void0),void0===p.initializer&&(Object.defineProperty(a,l,p),p=null),t=pvara,l,o,u,d,p
which is way wrong.
The text was updated successfully, but these errors were encountered:
NullVoxPopuli
added a commit
to NullVoxPopuli/repro-for-emberjs-19790
that referenced
this issue
Oct 14, 2021
🐞 Describe the Bug
After some investigation here: https://stackoverflow.com/questions/69547969/with-babel-how-do-i-not-compile-away-class-properties-since-browsers-support
And a minimal babel repro here: https://github.com/NullVoxPopuli/babel-transpilation-tests
I expect that setting my targets to
last 1 firefox versions
would allow me to keep native class properties. and only transpile what is decororated.I believe fixing this could provide a bit of a boost to everyone's build times. Today all class properties are transpiled to a time when class properties were not implemented in the browser).
🔬 Minimal Reproduction
last 1 Chrome versions
andlast 1 firefox versions
yarn browserslist --update-db
ember build -e production
rootURL
to be involved in an assignment, rather than a function call.result: https://github.com/NullVoxPopuli/repro-for-emberjs-19790
😕 Actual Behavior
Living in the dark ages
🤔 Expected Behavior
Utilize support for native properties, private properties, methods, etc.
🌍 Environment
➕ Additional Context
See the comparison between these two files:
Input: https://github.com/NullVoxPopuli/babel-transpilation-tests/blob/main/input.js
Output: https://github.com/NullVoxPopuli/babel-transpilation-tests/blob/main/output.js
This is correct.
But when I add that input file to ember, I get this for the output:
which... I guess is unrelated, but should still be fixed. Now, If I change the private methods/getters to public:
I get this mess:
which is way wrong.
The text was updated successfully, but these errors were encountered: