MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/g5har3/nodejs_v14_released/fo3ghvz
r/javascript • u/pimterry • Apr 21 '20
74 comments sorted by
View all comments
140
Looks like we finally get optional chaining and null coalescing!
0 u/[deleted] Apr 21 '20 [deleted] 29 u/[deleted] Apr 21 '20 I wish that's true but Node native ESM import has some subtle differences compare to Babel's implementation. 51 u/lhorie Apr 21 '20 Switch over to native ESM and you'll quickly find out what babel bugs you were relying on #move-fast-break-things 3 u/lulzmachine Apr 22 '20 Native ESM import is is sure way to make anybody using windows unhappy. And oh you want to be able clear something from the import cache and reload? Naaah... just naaaah. 2 u/schlenkster Apr 22 '20 Iām not sure if you can clear it, but you can import it again with a query string appended to get a fresh copy. 2 u/relativityboy Apr 22 '20 2005 much? → More replies (2) 0 u/[deleted] Apr 22 '20 [deleted] → More replies (1) 2 u/McThakken Apr 21 '20 Why? šš¤ 37 u/evilgwyn Apr 21 '20 Removing babel makes the none_modules folder smaller by about 50MB 12 u/calligraphic-io Apr 21 '20 Because none_modules is then an empty directory? :) 0 u/[deleted] Apr 21 '20 [deleted] → More replies (3) 9 u/ShortFuse Apr 21 '20 Babel will transcompile (downconvert) the ES2020 syntax code to something Node can understand (eg: CommonJS+ES2015).See https://node.green/ to see what version of NodeJS support what syntax. 6 u/[deleted] Apr 21 '20 [removed] ā view removed comment → More replies (2) 41 u/JonathanTheZero Apr 21 '20 laughs in TypeScript 12 u/ShortFuse Apr 21 '20 Well, if you're going to transcompile your code than of course you can use any syntax your want. You can use Babel and accomplish the same. 7 u/forsubbingonly Apr 21 '20 edited Apr 21 '20 Imagine transpiling your code from JavaScript to JavaScript lol 6 u/ShortFuse Apr 21 '20 babeljs.io → More replies (2) 2 u/NeverMakesMistkes Apr 22 '20 Lots of people also use Babel to compile TS to JS. It can be quite a bit faster if you just need the compilation and do type checking separately. 10 u/LetterBoxSnatch Apr 22 '20 Pendant: Babel doesn't compile TS to JS, it merely strips out the TS. That's why it's faster. 4 u/wetapotatoworkshop Apr 22 '20 I hope I caught you spelling "pedant" (overly teachy) as "pendant" (necklace thing)! → More replies (3) 2 u/lesleh Apr 22 '20 What does it do with code like this then? Just removing the types would change the semantics of the code.class Foo { constructor(public bar: string) { } } 2 u/csorfab Apr 22 '20 in what way would it change the semantics? → More replies (2) 14 u/aurbano Apr 21 '20 Huh TIL that I had been using optional chaining thanks to the TypeScript suggestions in vs code without realising it was thanks to the ts compiler :) → More replies (1)
0
[deleted]
29 u/[deleted] Apr 21 '20 I wish that's true but Node native ESM import has some subtle differences compare to Babel's implementation. 51 u/lhorie Apr 21 '20 Switch over to native ESM and you'll quickly find out what babel bugs you were relying on #move-fast-break-things 3 u/lulzmachine Apr 22 '20 Native ESM import is is sure way to make anybody using windows unhappy. And oh you want to be able clear something from the import cache and reload? Naaah... just naaaah. 2 u/schlenkster Apr 22 '20 Iām not sure if you can clear it, but you can import it again with a query string appended to get a fresh copy. 2 u/relativityboy Apr 22 '20 2005 much? → More replies (2) 0 u/[deleted] Apr 22 '20 [deleted] → More replies (1) 2 u/McThakken Apr 21 '20 Why? šš¤ 37 u/evilgwyn Apr 21 '20 Removing babel makes the none_modules folder smaller by about 50MB 12 u/calligraphic-io Apr 21 '20 Because none_modules is then an empty directory? :) 0 u/[deleted] Apr 21 '20 [deleted] → More replies (3) 9 u/ShortFuse Apr 21 '20 Babel will transcompile (downconvert) the ES2020 syntax code to something Node can understand (eg: CommonJS+ES2015).See https://node.green/ to see what version of NodeJS support what syntax. 6 u/[deleted] Apr 21 '20 [removed] ā view removed comment → More replies (2)
29
I wish that's true but Node native ESM import has some subtle differences compare to Babel's implementation.
51 u/lhorie Apr 21 '20 Switch over to native ESM and you'll quickly find out what babel bugs you were relying on #move-fast-break-things 3 u/lulzmachine Apr 22 '20 Native ESM import is is sure way to make anybody using windows unhappy. And oh you want to be able clear something from the import cache and reload? Naaah... just naaaah. 2 u/schlenkster Apr 22 '20 Iām not sure if you can clear it, but you can import it again with a query string appended to get a fresh copy. 2 u/relativityboy Apr 22 '20 2005 much? → More replies (2)
51
Switch over to native ESM and you'll quickly find out what babel bugs you were relying on #move-fast-break-things
3
Native ESM import is is sure way to make anybody using windows unhappy. And oh you want to be able clear something from the import cache and reload? Naaah... just naaaah.
2 u/schlenkster Apr 22 '20 Iām not sure if you can clear it, but you can import it again with a query string appended to get a fresh copy. 2 u/relativityboy Apr 22 '20 2005 much? → More replies (2)
2
Iām not sure if you can clear it, but you can import it again with a query string appended to get a fresh copy.
2 u/relativityboy Apr 22 '20 2005 much?
2005 much?
→ More replies (1)
Why? šš¤
37 u/evilgwyn Apr 21 '20 Removing babel makes the none_modules folder smaller by about 50MB 12 u/calligraphic-io Apr 21 '20 Because none_modules is then an empty directory? :) 0 u/[deleted] Apr 21 '20 [deleted] → More replies (3) 9 u/ShortFuse Apr 21 '20 Babel will transcompile (downconvert) the ES2020 syntax code to something Node can understand (eg: CommonJS+ES2015).See https://node.green/ to see what version of NodeJS support what syntax. 6 u/[deleted] Apr 21 '20 [removed] ā view removed comment → More replies (2)
37
Removing babel makes the none_modules folder smaller by about 50MB
12 u/calligraphic-io Apr 21 '20 Because none_modules is then an empty directory? :)
12
Because none_modules is then an empty directory? :)
none_modules
→ More replies (3)
9
Babel will transcompile (downconvert) the ES2020 syntax code to something Node can understand (eg: CommonJS+ES2015).
See https://node.green/ to see what version of NodeJS support what syntax.
6 u/[deleted] Apr 21 '20 [removed] ā view removed comment → More replies (2)
6
[removed] ā view removed comment
→ More replies (2)
41
laughs in TypeScript
12 u/ShortFuse Apr 21 '20 Well, if you're going to transcompile your code than of course you can use any syntax your want. You can use Babel and accomplish the same. 7 u/forsubbingonly Apr 21 '20 edited Apr 21 '20 Imagine transpiling your code from JavaScript to JavaScript lol 6 u/ShortFuse Apr 21 '20 babeljs.io → More replies (2) 2 u/NeverMakesMistkes Apr 22 '20 Lots of people also use Babel to compile TS to JS. It can be quite a bit faster if you just need the compilation and do type checking separately. 10 u/LetterBoxSnatch Apr 22 '20 Pendant: Babel doesn't compile TS to JS, it merely strips out the TS. That's why it's faster. 4 u/wetapotatoworkshop Apr 22 '20 I hope I caught you spelling "pedant" (overly teachy) as "pendant" (necklace thing)! → More replies (3) 2 u/lesleh Apr 22 '20 What does it do with code like this then? Just removing the types would change the semantics of the code.class Foo { constructor(public bar: string) { } } 2 u/csorfab Apr 22 '20 in what way would it change the semantics? → More replies (2)
Well, if you're going to transcompile your code than of course you can use any syntax your want. You can use Babel and accomplish the same.
7 u/forsubbingonly Apr 21 '20 edited Apr 21 '20 Imagine transpiling your code from JavaScript to JavaScript lol 6 u/ShortFuse Apr 21 '20 babeljs.io → More replies (2) 2 u/NeverMakesMistkes Apr 22 '20 Lots of people also use Babel to compile TS to JS. It can be quite a bit faster if you just need the compilation and do type checking separately. 10 u/LetterBoxSnatch Apr 22 '20 Pendant: Babel doesn't compile TS to JS, it merely strips out the TS. That's why it's faster. 4 u/wetapotatoworkshop Apr 22 '20 I hope I caught you spelling "pedant" (overly teachy) as "pendant" (necklace thing)! → More replies (3) 2 u/lesleh Apr 22 '20 What does it do with code like this then? Just removing the types would change the semantics of the code.class Foo { constructor(public bar: string) { } } 2 u/csorfab Apr 22 '20 in what way would it change the semantics? → More replies (2)
7
Imagine transpiling your code from JavaScript to JavaScript lol
6 u/ShortFuse Apr 21 '20 babeljs.io → More replies (2) 2 u/NeverMakesMistkes Apr 22 '20 Lots of people also use Babel to compile TS to JS. It can be quite a bit faster if you just need the compilation and do type checking separately. 10 u/LetterBoxSnatch Apr 22 '20 Pendant: Babel doesn't compile TS to JS, it merely strips out the TS. That's why it's faster. 4 u/wetapotatoworkshop Apr 22 '20 I hope I caught you spelling "pedant" (overly teachy) as "pendant" (necklace thing)! → More replies (3) 2 u/lesleh Apr 22 '20 What does it do with code like this then? Just removing the types would change the semantics of the code.class Foo { constructor(public bar: string) { } } 2 u/csorfab Apr 22 '20 in what way would it change the semantics? → More replies (2)
babeljs.io
Lots of people also use Babel to compile TS to JS. It can be quite a bit faster if you just need the compilation and do type checking separately.
10 u/LetterBoxSnatch Apr 22 '20 Pendant: Babel doesn't compile TS to JS, it merely strips out the TS. That's why it's faster. 4 u/wetapotatoworkshop Apr 22 '20 I hope I caught you spelling "pedant" (overly teachy) as "pendant" (necklace thing)! → More replies (3) 2 u/lesleh Apr 22 '20 What does it do with code like this then? Just removing the types would change the semantics of the code.class Foo { constructor(public bar: string) { } } 2 u/csorfab Apr 22 '20 in what way would it change the semantics? → More replies (2)
10
Pendant: Babel doesn't compile TS to JS, it merely strips out the TS. That's why it's faster.
4 u/wetapotatoworkshop Apr 22 '20 I hope I caught you spelling "pedant" (overly teachy) as "pendant" (necklace thing)! → More replies (3) 2 u/lesleh Apr 22 '20 What does it do with code like this then? Just removing the types would change the semantics of the code.class Foo { constructor(public bar: string) { } } 2 u/csorfab Apr 22 '20 in what way would it change the semantics? → More replies (2)
4
I hope I caught you spelling "pedant" (overly teachy) as "pendant" (necklace thing)!
What does it do with code like this then? Just removing the types would change the semantics of the code.
class Foo { constructor(public bar: string) { } }
2 u/csorfab Apr 22 '20 in what way would it change the semantics? → More replies (2)
in what way would it change the semantics?
14
Huh TIL that I had been using optional chaining thanks to the TypeScript suggestions in vs code without realising it was thanks to the ts compiler :)
140
u/mastermind202 Apr 21 '20
Looks like we finally get optional chaining and null coalescing!