Force-sensitive Human male who likes to drink his coffee at Lalamatine district.
He knows that 21 is only half the truth, believes that androids do dream of electric sheep and always carries a towel.
Nice Post!
but i wonder if the statment :
"Note that while importing something from the file, we don't need to add the .js extension to the filename as it's considered by default." is completely true.
All the time i use imports without ext the browsers complain, so i have to use a file extension. Which usually is .mjs so it is easier to distinguish modules.
@akman
If you're using any module bundler like webpack which React.js uses then you don't need to include the .js extension as it's optional. If want to use Es6 Import-export syntax inside Node.js then you may need to add .mjs extension as by default Node.js supports commonJS syntax and not ES Module syntax.
Force-sensitive Human male who likes to drink his coffee at Lalamatine district.
He knows that 21 is only half the truth, believes that androids do dream of electric sheep and always carries a towel.
Nice Post!
but i wonder if the statment :
"Note that while importing something from the file, we don't need to add the .js extension to the filename as it's considered by default." is completely true.
All the time i use imports without ext the browsers complain, so i have to use a file extension. Which usually is .mjs so it is easier to distinguish modules.
@akman If you're using any module bundler like webpack which React.js uses then you don't need to include the
.js
extension as it's optional. If want to use Es6 Import-export syntax inside Node.js then you may need to add.mjs
extension as by default Node.js supports commonJS syntax and not ES Module syntax.probably… but i use native JavaScript modules and not bundlers so i have to use extensions
Okay