yola / pixabayjs

A Javascript Client for the Pixabay API
MIT License
17 stars 6 forks source link

Unexpected reserved word #41

Open merlinstardust opened 8 years ago

merlinstardust commented 8 years ago

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

import assign from 'lodash.assign';
^^^^^^
SyntaxError: Unexpected reserved word
LionOps commented 8 years ago

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 commented 8 years ago

I'm using Meteor which does the transpilation automatically.

LionOps commented 8 years ago

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:

'use strict';

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

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

var _lodash2 = _interopRequireDefault(_lodash);

...

exports.default = pixabayjs;
> 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 commented 7 years ago

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

LionOps commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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.