Skip to content
This repository has been archived by the owner on Jun 29, 2018. It is now read-only.

Can I use this? Not sure how to handle Imports. #85

Open
chobo2 opened this issue May 16, 2017 · 1 comment
Open

Can I use this? Not sure how to handle Imports. #85

chobo2 opened this issue May 16, 2017 · 1 comment

Comments

@chobo2
Copy link

chobo2 commented May 16, 2017

Hi

I am using Reactjs and want to use a datepicker: https://github.com/Hacker0x01/react-datepicker

I have no clue how to make it work as the example uses

import React from 'react';
import DatePicker from 'react-datepicker';
import moment from 'moment';

I downloaded the scripts for each one

    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.5.4/react.min.js"> </script>

    <script type="text/javascript" src=" https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.js"></script>
 
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/react-datepicker/0.46.0/react-datepicker.js"></script>

React works just fine but when I try to use the Datepicker based on there example I get " Uncaught ReferenceError: DatePicker is not defined"

I think it is something to do with the imports.

@brownieboy
Copy link

brownieboy commented Nov 9, 2017

I'll belatedly answer this.

The short answer is "no". Neither Babel nor Babel Standalone (now part of Babel itself) are module bundlers. You'll need something like SystemJS if you want to use import and export statements in the browser.

You might also check out native bundling now that's finally seen the light of day some in the latest browsers - Chrome and Safari, anyway.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants