What are differences between SystemJS and Webpack?

SystemJS works client side. It loads modules (files) dynamically on demand when they are needed. You don’t have to load the entire app up front. You could load a file, for example, inside a button click handler. SystemJS code: // example import at top of file import myModule from ‘my-module’ myModule.doSomething() // example dynamic import … Read more

Angular – What is the meanings of module.id in component?

The beta release of Angular (since vesion 2-alpha.51) supports relative assets for components, like templateUrl and styleUrls in the @Component decorator. module.id works when using CommonJS. You don’t need to worry about how it works. Remember: setting moduleId: module.id in the @Component decorator is the key here. If you don’t have that then Angular 2 … Read more

Build Angular2 HTML and TypeScript to a single file

If you’re using the default Angular2 tsconfig.json with SystemJS loader: “module”: “system”, “moduleResolution”: “node”, … You can leave all the heavy work on SystemJS Build Tool. This is for example how I do it in my projects using gulp: Compile *.ts and inline *.html templates I’m using gulp-angular-embed-templates right away to inline all templateUrl into … Read more

How to prepare release version with SystemJS and Gulp?

You will get ” Unexpected anonymous System.register call” because the references are not being loaded in the correct order. I use JSPM to properly build my angular app for production. There are 4 parts to the process. Part 1: Compile your typescript files var ts = require(“gulp-typescript”); var tsProject = ts.createProject(“./App/tsconfig.json”); gulp.task(“compile:ts”, function () { … Read more

How do I actually deploy an Angular 2 + Typescript + systemjs app?

The key thing to understand at this level is that using the following configuration, you can’t concat compiled JS files directly. At the TypeScript compiler configuration: { “compilerOptions”: { “emitDecoratorMetadata”: true, “experimentalDecorators”: true, “declaration”: false, “stripInternal”: true, “module”: “system”, “moduleResolution”: “node”, “noEmitOnError”: false, “rootDir”: “.”, “inlineSourceMap”: true, “inlineSources”: true, “target”: “es5” }, “exclude”: [ “node_modules” … Read more