jayphelps/core-decorators

Unexpected token error in SyntaxErrorReporter

Closed this issue · 5 comments

I'm trying to integrate the facebook library into my project and it uses core-decorators. However, I'm getting this error when I load the library:

screen shot 2016-10-12 at 10 21 39 am

I'm using babel-preset-es2015 on stage 0. It seems that it doesn't like how the class fields are declared (without constructor). Anyway to fix this?

This is trying to use the code inside our src directory, which is untranspiled code. It should use the source inside lib instead or ideally rely on npm's module resolution for our main entry point.

You'll need to work with whoever is using core-decorators in this way to solve the issue. if you can let me know what facebook library you're using I can take a look as well.

Hi @jayphelps! Thanks for the quick response. I'm using this facebook repo that I'm adding to a react project that uses babel and webpack.

Okay, so it appears you're using react-boilerplate, which adds jsnext:main as a module entry which links to our untranspiled lib directory.

I totally forgot that we added jsnext:main to core-decorators package.json, and it likely never worked (it was meant for rollup in its early days) so I've since removed that field in my package.json and published core-decorators 0.13.0.

Unfortunately, you'd need to wait until facebook-node-sdk upgrades their core-decorators version for you to receive those changes cause remember, this problem is caused by your boilerplate using jsnext:main and your dependency facebook-node-sdk including core-decorators which has a jsnext:main that doesn't work with webpack2. (confusing)

One thing you could can try is is going into your boilerplate code and removing js:main from your mainFields webpack config. This might cause issues with other dependencies though...

¯_(ツ)_/¯ that's the best I can do on my end AFAICT.

Hi jay. Thanks for the help. I really appreciate it. I guess I'll just have to skip the facebook library for now and do ajax calls. Cheers!

@meilers best of luck! 🎉