-
Notifications
You must be signed in to change notification settings - Fork 5
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
Consume library using webpack instead of es6-server to use typescript #1815
Comments
Hey @FWeinb, thanks for taking a look at this. This repo is intended to be used as a library - we use it internally across a number of products using rollup as you say. We’ve done some experiments with webpack recently, so someone might be able to give you some pointers on this or see what we could do about this. Personally, I’d be happy to accept fixes to make it work with webpack or on codesandbox.io if we can maintain the current feature set. Thanks! |
Hey @FWeinb, thanks for raising this for us. As @pazdera mentioned above we are currently doing some experiments using webpack ourselves! Our current workaround for importing locale files (and others) is to use .webpack.config.js
index.js
It's a bit clunky at the moment and we will most likely improve the way to do this in the future but hope this helps for now 👍 |
Thanks for your help @joe-thom! Your solution is working beautifully. This library is really well build and documented! Thanks for making this open-source. After getting this running I made an initial effort in building some blocks to interact with LEGO® Powered Up using WebBluetooth. I made a little video showing it in action (click on image) Clicking on the button in the output will change the LED on the hub to a random color. Pressing the button on the Hub will in turn change the background color in the output. In the future I will add some more blocks to control connected motors and other sensors. Adding this to kano-code was really easy, thanks again for building this! |
@FWeinb glad that solved your problem and thanks for sending over the video - here at Kano we love seeing people use our tools in interesting ways (have shared with the rest of the team)! I'll leave the issue open for the moment as it would be great to get a permanent solution for this implemented in the future which could maybe also solve getting it working in environments like codesandbox.io. Thanks again for raising this! |
The first (fixable) issue is that we have to expose the
Tone
module aswindow.Tone
becauseTone
is distributed as an UMD module and webpack is using the ES6 export (this can be done usingwebpack.ProvidePlugin
see below).Another issue I am currently facing is that the dynamic fetching of l18n information here makes it impossible(?) for webpack to extract these files and bundles them into the final applications. My current workaround is to just copy the localisation into the destination manually.
This issue also applies to all other media fiels as all these aren't loaded in a way webpack can recognise them. (See default-resources.ts)
Any idea how this could be solved?
It looks like you are using rollup on http://world.kano.me so there should be a nice way to bundle this library into an application.
This also prevents
kano-code
(among another #1816) to be used on codesandbox.io which would be a great place to host the examples you are providing..babelrc
webpack.config.js
The text was updated successfully, but these errors were encountered: