TypeScript transpiling in WebStorm 2016.1 -
after upgrading webstorm 2016.1, typescript transpiling changed import statements different. keep getting js error 'require not defined'.
ts file:
import {bootstrap} 'angular2/platform/browser'; import {router_providers} 'angular2/router'; import {appcomponent} './application/app.component' import {http_providers} "angular2/http"; import {observable} 'rxjs/rx'; bootstrap(appcomponent, [router_providers, http_providers, observable]);
webstorm 11 transpiled version:
system.register(['angular2/platform/browser', 'angular2/router', './application/app.component', "angular2/http", 'rxjs/rx'], function(exports_1) { var browser_1, router_1, app_component_1, http_1; return { setters:[ function (browser_1_1) { browser_1 = browser_1_1; }, function (router_1_1) { router_1 = router_1_1; }, function (app_component_1_1) { app_component_1 = app_component_1_1; }, function (http_1_1) { http_1 = http_1_1; }, function (_1) {}], execute: function() { browser_1.bootstrap(app_component_1.appcomponent, [router_1.router_providers, http_1.http_providers]); } } });
webstorm 2016.1 transpiled version:
"use strict"; var browser_1 = require('angular2/platform/browser'); var router_1 = require('angular2/router'); var app_component_1 = require('./application/app.component'); var http_1 = require("angular2/http"); var rx_1 = require('rxjs/rx'); browser_1.bootstrap(app_component_1.appcomponent, [router_1.router_providers, http_1.http_providers, rx_1.observable]);
tsconfig.json file:
{ "compileroptions": { "target": "es5", "module": "commonjs", "moduleresolution": "node", "sourcemap": true, "emitdecoratormetadata": true, "experimentaldecorators": true, "removecomments": false, "noimplicitany": true, "suppressimplicitanyindexerrors":true }, "exclude": [ "node_modules", "bower-components" ] }
the typescript compiler set use typescript npm package , not bundled one.
Comments
Post a Comment