Tag Archives: AMD

Transpiling ES6 Modules to AMD & CommonJS Using Babel & Gulp


via Transpiling ES6 Modules to AMD & CommonJS Using Babel & Gulp.

ECMAScript 6 (a.k.a ECMAScript 2015 or ES6), the specification for next version of JavaScript has been approved and browser vendors are hard at work implementing it Unlike the previous versions of ECMAScript, ES6 comes with a huge set of changes to the language to make it a good fit for the scale at which it is used today. Sitepoint has a number of articles covering these features.

Although browsers haven’t implemented all of the features yet, we can already take advantage of ES6 during development and convert it to a version that browser understands before shipping the application.Babel and Traceur are two of the leading transpilers used for this purpose. Microsoft’s typed superset of JavaScript, TypeScript can also be used as an ES6 transpiler.

I covered how ES6 can be used today to write Angular 1.x applications in one of my previous articles. In this article I used Traceur’s on-the-fly transpiler to run the application. Although it works, it is always better to transpile beforehand and reduce the amount of work to be done in the browser. In this article, we will see how the same sample application can be transpiled to ES5 and the modules into either CommonJS or, AMD using Babel to make it run on today’s browsers. Though the sample is based on Angular, the techniques of transpilation can be used with any valid ES6 code.

As ever, you can find the code to accompany this article on our GitHub repo.

Transpiling ES6 Modules to AMD & CommonJS Using Babel & Gulp


via Transpiling ES6 Modules to AMD & CommonJS Using Babel & Gulp.

ECMAScript 6 (a.k.a ECMAScript 2015 or ES6), the specification for next version of JavaScript has been approved and browser vendors are hard at work implementing it Unlike the previous versions of ECMAScript, ES6 comes with a huge set of changes to the language to make it a good fit for the scale at which it is used today. Sitepoint has a number of articles covering these features.

Although browsers haven’t implemented all of the features yet, we can already take advantage of ES6 during development and convert it to a version that browser understands before shipping the application.Babel and Traceur are two of the leading transpilers used for this purpose. Microsoft’s typed superset of JavaScript, TypeScript can also be used as an ES6 transpiler.

I covered how ES6 can be used today to write Angular 1.x applications in one of my previous articles. In this article I used Traceur’s on-the-fly transpiler to run the application. Although it works, it is always better to transpile beforehand and reduce the amount of work to be done in the browser. In this article, we will see how the same sample application can be transpiled to ES5 and the modules into either CommonJS or, AMD using Babel to make it run on today’s browsers. Though the sample is based on Angular, the techniques of transpilation can be used with any valid ES6 code.

As ever, you can find the code to accompany this article on our GitHub repo.

Knockout Components using AMD


Content What are Knockout Components. How to create ko Components. How to load then asynchronously using RequireJs What are Knockout Components Knockout enables you to create declarative and reusable components similar to Angular directives.Components in knockout are combination of a view template and it’s model, they can be created as standalone components and can be […]

https://vasunagpal.wordpress.com/2015/07/06/knockout-components/

Javascript Modules


via Javascript Modules – MoodleDocs.

ES6 Modules: The End of Civilization As We Know It?


via ES6 Modules, AMD and CommonJS — Medium.

This article shares some techniques and tools for building web apps using future friendly ES6 module syntax. We begin with an exploration of current module formats and ways to work both forwards and backwards in time.The complete code for this article can be found here.

How to Write Highly Scalable and Maintainable JavaScript: Coupling


via How to Write Highly Scalable and Maintainable JavaScript: Coupling.

In the previous chapter of this series, we discussed modular JavaScript. We looked at native patterns and some of the prominent modular specifications and formats such as AMD, CommonJS, etc.

In this final chapter, we’ll examine ways to reduce coupling between JavaScript modules.

Chapters

  1. The “Wild West” Syndrome
  2. Namespacing
  3. Modules
  4. Coupling

Create graphs from your CommonJS or AMD module dependencies


Click to Read: Create graphs from your CommonJS or AMD module dependencies. Could also be useful for finding circular dependencies in your code. Tested on Node.js and RequireJS projects. Dependencies are calculated using static code analysis. CommonJS dependencies are found using James Halliday’sdetective and for AMD I’m using amdetective. Modules written in CoffeeScript with extension .coffee are supported and will automatically be compiled on-the-fly.