node.js - tsconfig compilerOptions "module": "system" not working -
in angular2 5 min tutorial use "system" module in tsconfig. have systemjs node_module when trying start server system not defined, first line of compile js-file looks this: system.register(['http', 'express', './config/index', 'path'], function(exports_1) {
why system undefined though have node dependency?
i trying change commonjs, compiled js looks simpler. errors in angular application.
what missing in order work systemjs?
edit
i think bad @ explaining problem. when changing importing modules server.ts file "javascript style" (var http = require('http');) guess "typescript style" (import * http 'http';) start getting error specified above. when doing javascript style compiled js looks same ts (var http = require('http');) when doing "typescript style" gets compiled modules being imported using system (the line of code specified above). i'm getting error when trying start node server , not in browser.
i tried changing compileroption "module" "commonjs" instead of "system" in tsconfig.json, doing causes errors in browser (this error, solutions doesn't seem fit) weird reason figured i'd try "system". ran problem of not have system defined. how access system when starting node server?
it looks missing reference system.js in index.html. angular meant run browsers not enough have node dependency, browser not load automatically. , of course not try run angular application on server side in node.js. want on server-side (node.js) run web server serve content browser (http-server, lite-server, etc). , open index.html served web server in browser in turn run angular2 application using system.js module loading.
if have system.js referenced in index.html , not trying run on node.js server side - make sure path correct , loaded - using development tools of modern browser.
Comments
Post a Comment