Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Start to work with rollup.js to pack JS files

rollup.js is a module bundler for JavaScript. It compiles small piece of JavaScript modules spreading in different files into a single larger standardized ES code file. This post will show some entry level usage for this library.IntroductionNormally a bundler tool would compile a few small JavaScript files into a single JavaScript so that web browser can read, parse and render it properly. A bundler tool may be needed because of a few reasons:Some early stage browsers don't understand modules, the modularized JS codes need to be packed into standard JS code so that browser can understandThe mo...

1,710 0       WEBPACK BUNDLE ES MODULE COMMONJS ROLLUP.JS


  How to handle ES6 modules in NodeJS

In modern JavaScript, there are two types of modules: ES6 module and CommonJS module used by NodeJS. These two types of module are not compatible. Many people would wonder how to load ES6 modules in their NodeJS project. This post will show how this can be done.DifferenceThe syntax of the module being loaded is different. CommonJS modules are loaded with require() and exported with module.exports. ES6 modules are loaded and exported using import and export respectively.Merchanismwise require() is doing sequential loading, other statements must wait for this statement to complete before executi...

4,374 0       COMMONJS ES6 NODEJS