Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected reserved word #41

Open
merlinstardust opened this issue Jun 8, 2016 · 7 comments
Open

Unexpected reserved word #41

merlinstardust opened this issue Jun 8, 2016 · 7 comments

Comments

@merlinstardust
Copy link

When I attemmpt to import pixabay, I get the following error.

import assign from 'lodash.assign';
^^^^^^
SyntaxError: Unexpected reserved word
@LionOps
Copy link
Contributor

LionOps commented Jun 8, 2016

It's likely caused by not using a transpiler to convert es2015 code into es5. The lib is setup to use babel in tandem with browserify via babelify, so if you use browserify to create a bundle, the transpiling should happen automatically.

@merlinstardust
Copy link
Author

I'm using Meteor which does the transpilation automatically.

@LionOps
Copy link
Contributor

LionOps commented Jun 8, 2016

I'm not familiar with how Meteor does its transcompiling or its builds, but it sounds like an issue on Meteor's end.

I was able to do the following with no problems:

  • babel src -d lib in pixabayjs's root folder. That resulted in a lib folder where index.js had the following code
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _lodash = require('lodash.assign');

var _lodash2 = _interopRequireDefault(_lodash);

...

exports.default = pixabayjs;
  • Then, in node REPL, I did the following:
> var pixabay = require('./lib/index')
undefined
> pixabay
{ default:
   { _auth: {},
     defaults: {},
     authenticate: [Function: authenticate],
     resultList: [Function: resultList] } }
>

It might be that we need to add a babel config option in `package.json'. Perhaps try that to see if it resolves the issue, but without more details, it's likely a fault of meteor. If you figure a solution out, a PR is welcome.

@dderevjanik
Copy link

Hi,
I'm also getting this error. Is there any chance that you'll distribute transpiled es5 code ?

@LionOps
Copy link
Contributor

LionOps commented Jun 29, 2017

I'm also getting this error. Is there any chance that you'll distribute transpiled es5 code ?

We can look into doing a prepublish hook that would do that.

@dderevjanik
Copy link

dderevjanik commented Jun 29, 2017

That would be cool :) .
I found also another bug (or feature), that pixabayjs works on client and it doesn't have types (TS | Flow) :( , so I created my own implementation of pixabay API. You can look here https://github.com/dderevjanik/pixabay-api.

@LionOps
Copy link
Contributor

LionOps commented Jun 29, 2017

I found also another bug (or feature), that it only works on client and it doesn't have types (TS | Flow) :

Could you create new tickets for those? I'm not sure how likely we are to introduce types (but a pull would be welcome!), but it's something that can be discussed.

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

No branches or pull requests

3 participants