I am trying to create an application with Angular2, typescript, stylus (for css) and pug (for html templating).
But I can not get it to work with Angular2 Universal.
The problem is that I use ts-nodeto run the server code, and whenever I import the App component, an error occurs.
server.ts (node / express):
import 'angular2-universal/polyfills';
import * as path from 'path';
import * as express from 'express';
import * as bodyParser from 'body-parser';
import {
provide,
enableProdMode,
expressEngine,
REQUEST_URL,
ORIGIN_URL,
BASE_URL,
NODE_ROUTER_PROVIDERS,
NODE_HTTP_PROVIDERS,
ExpressEngineConfig
} from 'angular2-universal';
import {App} from './app/modules/app';
An error has occurred:
app / modules / app / app.styl: 2 margin-bottom: 10px ^ Syntax Error: Unexpected token:
app.ts
import {Component, ViewEncapsulation} from '@angular/core';
import {RouteConfig, Router, ROUTER_DIRECTIVES} from '@angular/router-deprecated';
import {Home} from '../home';
@Component({
selector: 'app',
pipes: [ ],
providers: [ ],
directives: [ ],
encapsulation: ViewEncapsulation.None,
styles: [
require('./app.styl')
],
template: require('./app.pug')
})
app.styl
input
margin-bottom: 10px
An alternative is to run assembly code (generated by webpack). But how can I do this since the code is wrapped in a function webpackjsonp.