7/19/2023 0 Comments Nodejs es6If you don’t use typescript you might have to do some rewriting if you want to get your app updated. If you use typescript you can change just change your tsconfig settings to output ECMAScript es6 modules and you will be good to go. You can just use import module from "module" directly in your transpiled code. This step is not necessary in modern Node.js applications. Typescript will then transpile this import syntax into commonjs require statements for you. Instead of commonjs require("module") most typescript applications use some variation of import module from "module". If you’ve used typescript in the past few years you will be familiar with the module import syntax in you application. JavaScript developers and node libraries have typically used commonjs for modules up to now. Es6 modules now have full support in Node.js 12 and above so it’s time to start using them. ECMAScript modules are the official standard format to package JavaScript code for reuse in the future.
0 Comments
Leave a Reply. |