wangzuo / input-moment

React datetime picker powered by momentjs
https://wangzuo.github.io/input-moment
ISC License
526 stars 172 forks source link

Cannot import input-moment #9

Closed arnekolja closed 8 years ago

arnekolja commented 8 years ago

Hi,

I am having problems importing your library.

import InputMoment from 'input-moment'

throws an unexpected token error on JSX-style html tags in your code (uncompiled JSX). When importing from the dist folder it compiles (import InputMoment from 'input-moment/dist/input-moment'), but then I get the error:

ReferenceError: Can't find variable: React | input-moment.js:1

Do you have any idea why? Is it a bug in deployment or is it just me? :-) I'm trying it on a project that works like a charm otherwise, built by a gulp build script using babelify+browserify.

wangzuo commented 8 years ago

You may try babel-preset-react to use jsx with babelify.

The dist version requires window.React available.

arnekolja commented 8 years ago

I have that already, it is the setup that is not working. Could you provide an example that's using it?

rskumar commented 8 years ago

I am too getting error while importing... ERROR in D:/[...]/~/input-moment/src/input-moment.js Module parse failed: D:\[...]\node_modules\input-moment\src\input-moment.js Line 28: Unexpected token < You may need an appropriate loader to handle this file type. | | return ( | <div className="m-input-moment"> | <div className="options"> | <button type="button" className={cx('ion-calendar im-btn', {'is-active': tab === 0})} onClick={this.handleClickTab.bind(null, 0)}> @ D:/[...]/~/input-moment/index.js 1:17-46

crussi commented 8 years ago

Me three, I'm getting error importing ...

Robinnnnn commented 8 years ago

Getting the same error as @rskumar

shashankKeshava commented 8 years ago

Facing the same Issue

youfoundron commented 8 years ago

+1