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

Update Example Code in Readme #33

Closed
palamccc opened this issue Feb 22, 2016 · 4 comments
Closed

Update Example Code in Readme #33

palamccc opened this issue Feb 22, 2016 · 4 comments

Comments

@palamccc
Copy link

I installed react-sidebar today and got version 2.1.1 from npm. I think latest version uses new es7 module syntax.

But Readme in github uses commonjs syntax.

@balloob
Copy link
Owner

balloob commented Feb 22, 2016

The ES2015 class is the source code but the package.json points at the ES5 version. No need to update it.

@balloob balloob closed this as completed Feb 22, 2016
@palamccc
Copy link
Author

Few hours ago, I installed it, and require('react-sidebar') is not working. to make it work, i am actually using it as

var Sidebar = require('react-sidebar').default;

Instead of

var Sidebar = require('react-sidebar');

I am not good in new module syntax, But in below file, there is no module.exports , so just require('react-sidebar') wont work.
https://github.com/balloob/react-sidebar/blob/master/dist-modules/index.js

@Cleod9
Copy link

Cleod9 commented Mar 28, 2016

@balloob Curious, why did you close this issue? Seems like it might be a good idea to at least update the readme. Since ES6 modules are still fairly new, it might be a good idea to instruct folks using ES5 that they will need to write require('react-sidebar').default || require('react-sidebar');. Your current solution will only import properly as-is if the consumer us using an ES6 transpiler that can interpret the __esModule flag (such as babel)

Related discussion: esnext/es6-module-transpiler#85

@balloob
Copy link
Owner

balloob commented Mar 29, 2016

My bad. Both of you are right. Updated the README: 4241bbd

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

3 participants