Urigo / angular2-meteor

Angular 2.0 and Meteor - the perfect stack
http://www.angular-meteor.com/
298 stars 61 forks source link

Sublime typscript cannot resolve module properly in tutorial #181

Closed sunshineo closed 8 years ago

sunshineo commented 8 years ago

Hello,

I'm following tutorial here http://www.angular-meteor.com/tutorials/socially/angular2/bootstrapping After step 0.8, the error on the console went away as the tutorial said it would but my sublime still cannot resolve the types properly.

sublime

As you can see, it says: Module "angular2/core" resolves to a non-module entity and cannot be imported using this construct. You can also see that I tried to reference the definition file directly using /// <reference path="../typings/angular2-meteor/angular2-meteor.d.ts" /> . It has no effect. My tsconfig.json:

{
  "files": [
    "typings/main.d.ts",
    "typings/angular2-meteor/angular2-meteor.d.ts"
  ]
}

Now, I have installed typescript plugin for my sublime. When I was following the angular 2 tutorial at https://angular.io/docs/ts/latest/tutorial/ , everything works fine.

Any idea helps. Thanks in advance.

sunshineo commented 8 years ago

Sublime is happy if I use

import {Component, View, NgZone} from '../typings/angular2/core';

But meteor compiler will say things are broken.

sunshineo commented 8 years ago

Solution provided at chapter 7 http://www.angular-meteor.com/tutorials/socially/angular2/folder-structure

mjwheatley commented 8 years ago

Which part of the chapter specifically helped you resolve this issue. My issue is not with my IDE. I receive this message it the terminal when I run my app.

This is my tsconfig.json

"compilerOptions": {
    "diagnostics": true,
    "noResolve": false,
    "experimentalDecorators": true,
    "module": "commonjs",
    "target": "es5",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "sourceMap": true
  },
  "meteorCompilerOptions": {
    "alwaysThrow": false,
    "useCache": true
  },
  "files": [
    "typings/main.d.ts",
    "typings/angular2-meteor/angular2-meteor.d.ts"
  ]
sunshineo commented 8 years ago

My problem was with IDE only. The section TypeScript Configuration and IDEs helped me.

mjwheatley commented 8 years ago

I am using Meteor 1.3 and apparently I did not need all the typings that I had because the Meteor 1.3 compiler automatically loads them from the node_modules folder. Thanks to the response from @barbatus for helping to point me in the right direction.