Cov txheej txheem:

Puas yog node 12 txhawb es6?
Puas yog node 12 txhawb es6?

Video: Puas yog node 12 txhawb es6?

Video: Puas yog node 12 txhawb es6?
Video: Cas Tsis Xaiv Koj - R-Lin Thoj New Song Original By Zaj Dub [Official MV] 2023 2024, Kaum ib hlis
Anonim

Nws yog thaum kawg tshwm sim: ze li ntawm 4 xyoo tom qab ntshuam lo lus tseem ceeb tau qhia hauv ES 6 , Node . js qhia kev sim kev txhawb nqa rau ES 6 import thiab export. Hauv Node . js 12 , koj tuaj yeem siv ntshuam thiab xa tawm hauv koj qhov project yog tias koj ua ob qho tib si hauv qab no.

Xav txog qhov no, node puas txhawb es6?

ECMAScript 2015 ( ES 6 ) thiab tshaj. Node . js tau tsim tawm tsam niaj hnub versions ntawm V8. Los ntawm kev ua raws li cov kev tshaj tawm tshiab ntawm lub cav no, peb xyuas kom meej cov yam ntxwv tshiab ntawm JavaScript ECMA-262 specification raug coj mus rau Node.

Tsis tas li ntawd, yog node 12 rov qab tau tshaj? Node . js versions feem ntau yog rov qab sib haum , txhais tau tias code koj sau rau Node 8 yuav ua haujlwm Node 10 lub 12 . Yog li, yog tias koj tsuas muaj qhov qub JavaScript koj yuav tsum ntsib tsis muaj teeb meem kho dua tshiab.

Kuj nug, yog node 12 ruaj khov?

Nod 12 yuav pib khiav ntawm V8 7.4 thiab nws thiaj li hloov mus rau 7.6 thaum nws lub neej. Pab pawg V8 tau pom zoo muab ABI (Application Binary Interface) ruaj khov rau qhov chaw no.

Koj siv ESM node li cas?

Muaj ob txoj hauv kev los pab esm

  1. Pab kom esm rau pob khoom: Siv esm los thauj cov ES tseem ceeb thiab xa tawm raws li CommonJS. index.js. // Teem cov kev xaiv ua ib qho parameter, ib puag ncig hloov pauv, lossis rc cov ntaub ntawv.
  2. Qhib esm rau hauv zos khiav: node -r esm main.js. ?? Tshem tawm cov ntaub ntawv npe kom pab esm hauv REPL.

Pom zoo: