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

This code cannot be converted from ES6. extending native class: Array #22

Closed
lilactown opened this issue Aug 8, 2018 · 4 comments
Closed

Comments

@lilactown
Copy link

lilactown commented Aug 8, 2018

Trying to run this in a Google Closure context (compiling to ES5), I'm running into this error when I install and import it via NPM, then compile it:

Closure compilation failed with 1 errors
--- node_modules/pts/dist/index.js:288
This code cannot be converted from ES6. extending native class: Array

Is there a way that you could provide an ES5-compatible bundle?

@lilactown
Copy link
Author

So I read the technical notes and realized that this was purposeful.

I'm actually trying to use this in ClojureScript, so I'll use this issue to document how I can get it to work using ClojureScript and shadow-cljs.

@williamngan
Copy link
Owner

Yes, Pt extends Float32Array so that we can keep all the native functions while adding new ones.

Last I tried builtin-extend babel plugin and have some success, but I couldn't get it to work with React if I remember correctly. Also modern browsers support es6 so I decided to keep it as is. Maybe now it's time to revisit.

Your use case is very interesting! It would be awesome if you can share your progress and learnings here. Does ClojureScript require es5?

@lilactown
Copy link
Author

It doesn't require ES5 but it is the default.

For those that might be finding this later, I was able to get it work with the shadow-cljs v2.4.33 compiler using the following option in my build config:

:js-options {:language-out :ecmascript6}

I think that similar would work with the vanilla CLJS compiler.

I'm having some other issues (i'm also using React) but I'll open another issue for that 😉

@williamngan
Copy link
Owner

Thanks @Lokeh .

Yes, the React example is having issues. I'll try to fix it as soon as possible.

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

2 participants