Reputation: 34544
When trying to use tsc
with my ionic2 project, i am getting the following error on a typescript file.
The Error:
TS2307: Cannot find module 'ionic/ionic'
The Code:
import {Page} from "ionic/ionic" //error happens on this line
@Page({
templateUrl: 'app/list/list.html',
})
export class ListPage {
constructor() {}
}
My tsconfig.json file:
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"sourceMap": true,
"isolatedModules": true,
"noEmitOnError": false,
"rootDir": ".",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
"compileOnSave": false
}
My npm -g list:
[email protected]
[email protected]
[email protected]
[email protected]
Upvotes: 6
Views: 5518
Reputation: 620
I have the same issue on ionic2.0.0-beta.17
For typescript need to change import path for all core components.
In your case from
import {Page} from "ionic/ionic"
to
import {Page} from 'ionic-framework/ionic'
P.s: this is just for typescript. For native JS ionic2 app path remains the same (ionic/ionic).
Upvotes: 0
Reputation: 34544
This seems to have been resolved in "ionic-framework": "2.0.0-alpha.38"
.
Upvotes: 1
Reputation: 7025
See issue 84
We still need to create a definition file for ionic 2. So until then, the typescript compiler will yell a lot, but it will still compile the code correctly.
Upvotes: 1
Reputation: 2795
Yo need to include the ionic typescript definition file. You can download it from here https://www.nuget.org/packages/cordova-ionic.TypeScript.DefinitelyTyped/
Upvotes: -1