Concept understanding: ES6 Modules
I'm taking a class on NodeJS, which uses commonJS syntax in order to import and export modules.
ES6 syntax can also be used to import and export modules as well, however only on Browser-run JS with the needed <script type = "module"> attribute. ES6 syntax is not recognized in NodeJS since NodeJS was released prior to ES6. Else, if ES6 syntax can be used in a non-browser context, it would have to be for a different "runtime environment" than NodeJS. Is this close to correct?
ES6 syntax can also be used to import and export modules as well, however only on Browser-run JS with the needed <script type = "module"> attribute. ES6 syntax is not recognized in NodeJS since NodeJS was released prior to ES6. Else, if ES6 syntax can be used in a non-browser context, it would have to be for a different "runtime environment" than NodeJS. Is this close to correct?
4 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ah gotcha ok
This is cool yet I still prefer CommonJs syntax in nodeJs.
Please keep Node.js related questions in #back-end