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

Compile to ES5 before publishing to NPM #42

Open
radavis opened this issue Apr 14, 2017 · 12 comments
Open

Compile to ES5 before publishing to NPM #42

radavis opened this issue Apr 14, 2017 · 12 comments
Milestone

Comments

@radavis
Copy link

radavis commented Apr 14, 2017

It would be helpful if this was compiled to ES5. Webpack/Babel isn't able to compile it when added as a dependency to package.json.

http://stackoverflow.com/questions/43417654/create-react-app-and-javascript-dependency-that-is-using-async-await-fails-to-co/43418589#43418589

@schmich
Copy link
Owner

schmich commented Apr 16, 2017

Thanks, I completely overlooked this. There are a handful of breaking changes coming in for a 2.0 release, so I will be sure to precompile the library to ES5 before publishing the new package.

@schmich schmich added this to the 2.0.0 milestone Apr 16, 2017
@adrienshen
Copy link

Yes, was not able to use this today because async/await not support by create-react-app. What solution do you recommend in order to use this from npm.

@schmich
Copy link
Owner

schmich commented Apr 19, 2017

@adrienshen This was a bad mistake on my part. There's nothing you can reasonably do right now unless you want to clone the source, build the library, and manually use it in your project (probably not worth the hassle).

I'm working on a fix now and should have something published this week.

@schmich
Copy link
Owner

schmich commented Apr 26, 2017

Apologies for the delay here, guys. JS source packaging and distribution is a mess of complexity, in my opinion, between needing to support the various build systems, environments, package managers, and module loaders.

After doing some research, it appears the correct approach is to provide both precompiled and vanilla source in the same package.

By doing this, you can either:

  • Use the precompiled source directly with downsides of compilation size and lack of debugability
  • Use the vanilla source and build it natively with the downsides of compilation time and build integration complexity

I'm hoping to have a reasonable solution soon. Thanks for your patience.

@scmx
Copy link

scmx commented May 19, 2017

👋 I ran into the same problem. Here's an example project that reproduces an error using it. https://github.com/scmx/experiment-instascan-babel-brunch/commits/master
I tried to work around it by having brunch transpile it for me, but I didn't succeed.

@scmx
Copy link

scmx commented May 19, 2017

Uncaught Error: only one instance of babel-polyfill is allowed

http://stackoverflow.com/a/41797876 Generally only overall applications should be loading global plugins. If you're writing a library like a Babel plugin, you should either assume the user of your library will load it for you, or you should use transform-runtime.

scmx added a commit to scmx/instascan that referenced this issue May 19, 2017
@pacoccino
Copy link

@scmx I managed to get mine working with your branch https://github.com/scmx/instascan/tree/replace-babel-polyfill-with-transform-runtime merged from master.

Make a PR ;)

Thx

@scmx
Copy link

scmx commented May 21, 2017

@pakokrew Pull request against 1.0.0 or latest master?

@pacoccino
Copy link

If think I tried with latest master @scmx

@brunoschuermans
Copy link

schmich,
when do you think your release 2 will be ready and particularly this point?
Greets

@minatonda
Copy link

i'm having same problem =/

@augustosamame
Copy link

augustosamame commented Aug 15, 2018

Any updates? So is this working on react-native? Would like confirmation before making the plunge ;)

optout21 pushed a commit to mikroncoin/instascan that referenced this issue May 7, 2019
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

8 participants