shlomiassaf / ngx-modialog

Modal / Dialog for Angular
http://shlomiassaf.github.io/ngx-modialog
MIT License
686 stars 241 forks source link

A lot of 'ERROR TS2300' when setting up webpack server #13

Closed haoliangyu closed 8 years ago

haoliangyu commented 8 years ago

I try to import angular2-model objects in my project using following code

import {Component, provide, ElementRef, Injector, IterableDiffers, KeyValueDiffers, Renderer} from 'angular2/core';

import {ModalDialogInstance} from '../../node_modules/angular2-modal/dist/models/ModalDialogInstance';
import {ModalConfig} from '../../node_modules/angular2-modal/dist/models/ModalConfig';
import {Modal} from '../../node_modules/angular2-modal/dist/providers/Modal';
import {ICustomModal} from '../../node_modules/angular2-modal/dist/models/ICustomModal';

import {YesNoModalContent, YesNoModal} from '../../node_modules/angular2-modal/dist/commonModals/yesNoModal';
import {OKOnlyContent, OKOnlyModal} from '../../node_modules/angular2-modal/dist/commonModals/okOnlyModal';

However, when I run webpack-dev-server, I get many 'ERROR TS2300'. Just take some as examples:

    ERROR in /home/mypc/Documents/Projects/angular2-leaflet-starter/node_modules/angular2/manual_typings/globals-es6.d.ts
    (34,3): error TS2300: Duplicate identifier 'clearTimeout'.

    ERROR in /home/mypc/Documents/Projects/angular2-leaflet-starter/node_modules/angular2/manual_typings/globals-es6.d.ts
    (35,3): error TS2300: Duplicate identifier 'setInterval'.

    ERROR in /home/mypc/Documents/Projects/angular2-leaflet-starter/node_modules/angular2/manual_typings/globals-es6.d.ts
    (36,3): error TS2300: Duplicate identifier 'clearInterval'.

I use ts-loader to handle all typescript files and my webpack config is here.

When I remove all imports, everything works fine. I am currently using angular 2.0.0 beta.1, is that the reason?

sunnyque commented 8 years ago

Yes beta.1 is a reason, got same yesterday. angular-modal uses beta.0 so here is a trouble. Remove angular2 reference from angular2-modal\node_modules it should be okay.

haoliangyu commented 8 years ago

@sunnyque What do you mean by removing angular2 reference from angular2-modal\node_modules?

sunnyque commented 8 years ago

@haoliangyu remove angular2 folder from your projects ./../node_modules/angular2-modal/node_modules

@shlomiassaf please change dependencies in package.json from "angular2": "2.0.0-beta.0", to "^2.0.0-beta.0"

shlomiassaf commented 8 years ago

Did you try latest npm package? it should fix the issue.

haoliangyu commented 8 years ago

@shlomiassaf The problem is fixed. Thanks