I really like angular's core modules and I'm trying to use some of these features in a node/io.js environment ; i.e: to transpile angular modules into ES5 modules in commonjs format.
I attempted to build angular modules by hand one by one using traceur without success (generates circular dependency) and also tried to adapt angular project's gulpfile.js
in order to produce an ES5 output in commonjs format:
var _COMPILER_CONFIG_JS_DEFAULT = {
sourceMaps: true,
annotations: true, // parse annotations
types: true, // parse types
script: false, // parse as a module
memberVariables: true, // parse class fields
modules: 'commonjs'
};
... running build/transpile.js.dev task, but I keep facing this message:
TypeError: Cannot call method 'map' of undefined
Even by changing sourceMaps
in default config, I can't get a rid of this map
error.
I also noticed their transpiler tool, which seems to actually handle the output formatting. But I had no chance by changing its options. I only can result with default config in files in System.register
format that I can't convert to commonjs.
Does anyone that went through all this have a solution to use angular's modules in a commonjs-style project? Note that I want to use it as a library and I don't want to convert my project to another type of modules system.
Any advice is welcome, thanks!
Use a CommonJS wrapper to map Angular modules, such as this example: