cubing / scramble-display

🔀 An HTML library to display puzzle scrambles. No knowledge of Javascript required!
https://experiments.cubing.net/scramble-display/
GNU General Public License v3.0
20 stars 1 forks source link

Module parse failed when trying to import js file #1

Closed big213 closed 4 years ago

big213 commented 4 years ago

Module parse failed: Unexpected token (1:7878)

Appears to be a ?? operator there in /dist/scramble-display.js

lgarron commented 4 years ago

Thanks! That should be easy to fix.

Would you mind letting me know how specifically you're running this, and in what browser?

(I'm aware that this project still needs a good description of how to download/install the library, so I'm curious what you're doing.)

lgarron commented 4 years ago

If you were using npm, please try version 0.0.5. Let me know if it works!

big213 commented 4 years ago

Just upgraded to 0.0.5 but now I'm getting this error: HTMLElement not defined

Appears to be related to this line in /dist/scramble-display.js:

class ScrambleDisplay extends HTMLElement{constructor()...

Browser is Chrome Version 81.0.4044.138

Usage is pretty basic, just trying to import { ScrambleDisplay } from "scramble-display" as in the javascript example.

big213 commented 4 years ago

Oops, you can ignore the above comment. I was trying to load that on the server side, where HTMLElement was of course not available. Thanks for your prompt attention, I believe this issue is closed now.

lgarron commented 4 years ago

Oops, you can ignore the above comment. I was trying to load that on the server side, where HTMLElement was of course not available. Thanks for your prompt attention, I believe this issue is closed now.

Ah, yeah, I haven't tried to implement anything for the server yet. That's a fairly involved task.

lgarron commented 4 years ago

Ah, yeah, I haven't tried to implement anything for the server yet. That's a fairly involved task.

To be clear, I definitely want to be able to to render puzzles on the server. That might fit into this project (e.g. rendering static SVGs/images into the DOM), or belong in https://github.com/cubing/cubing.js but it would would still require a bit of design.

big213 commented 4 years ago

Ah, yeah, I haven't tried to implement anything for the server yet. That's a fairly involved task.

To be clear, I definitely want to be able to to render puzzles on the server. That might fit into this project (e.g. rendering static SVGs/images into the DOM), or belong in https://github.com/cubing/cubing.js but it would would still require a bit of design.

For sure, yeah I think that could be a nice feature for server-side rendered apps that want to make use of this. But for my purposes, I have an SPA that is rendered purely on front end so it is not necessary. I just had it set to SSR mode before by mistake, and that's why I got that error.

lgarron commented 4 years ago

For sure, yeah I think that could be a nice feature for server-side rendered apps that want to make use of this. But for my purposes, I have an SPA that is rendered purely on front end so it is not necessary. I just had it set to SSR mode before by mistake, and that's why I got that error.

I'd definitely be interested to hear your case!

It's useful to know who's using our code and how, so we know what to focus on next and what not to break. Perhaps we should start a "who's using this" brag sheet. :-P

big213 commented 4 years ago

It's cube.zone here. On production we are using kpuzzle still, but we've implemented this package successfully on our staging environment and hopefully it will be introduced to production around next weekend. Really liking it so far, especially the ability to toggle between the 2D/3D visualizations. Nice work with the package so far!

lgarron commented 4 years ago

It's cube.zone here. On production we are using kpuzzle still, but we've implemented this package successfully on our staging environment and hopefully it will be introduced to production around next weekend. Really liking it so far, especially the ability to toggle between the 2D/3D visualizations. Nice work with the package so far!

Ah, glad to hear it! Sites like cube.zone were a major motivator.

I wasn't able to find the source code for cube.zone to see how you're using it, so just make sure to keep in mind that you need to be able to share your source code if you end up using this (GPL-licensed) library! (Previous libraries were in a legally unresolvable places with regards to licensing, and one goal of making everything from scratch is to make the licensing terms clear.)

big213 commented 4 years ago

It's cube.zone here. On production we are using kpuzzle still, but we've implemented this package successfully on our staging environment and hopefully it will be introduced to production around next weekend. Really liking it so far, especially the ability to toggle between the 2D/3D visualizations. Nice work with the package so far!

Ah, glad to hear it! Sites like cube.zone were a major motivator.

I wasn't able to find the source code for cube.zone to see how you're using it, so just make sure to keep in mind that you need to be able to share your source code if you end up using this (GPL-licensed) library! (Previous libraries were in a legally unresolvable places with regards to licensing, and one goal of making everything from scratch is to make the licensing terms clear.)

Ah yes, totally understood. I plan on making it a public repo very soon, in about a week. Just need to tidy up some code and prepare the repo, hope that's alright!

big213 commented 4 years ago

As promised, cube-zone source is now publicly available at https://github.com/Kubiverse/Cube-Zone

We are using your scramble-display package in our production app at https://cube.zone