grofit / aurelia-chart

A chart element for aurelia which is powered by chart js using html5 canvas.
MIT License
46 stars 25 forks source link

Add Webpack support - issue #14 #16

Closed ghiscoding closed 7 years ago

grofit commented 7 years ago

will look to action this later on today when I have some time to sit down and go through it, but dont worry it will be actioned shortly.

grofit commented 7 years ago

There are a lot of wp-example stuff in there that seem to be just boilerplate aurelia files which serve no purpose, are any of them needed? and if not can they be culled?

ghiscoding commented 7 years ago

it's based on the Aurelia Skeleton, so yes there's a lot that isn't needed. If you're talking about just pages to be removed, that's easy but if you're talking about the package.json, then I would rather not touch that one.

grofit commented 7 years ago

just anything which isnt required, I dont want to bloat the plugin any more than is needed, the other example that is in there is just a barebones one, so am happy for you to add more but I would ideally like them to be bare bones ones too.

ghiscoding commented 7 years ago

There you go, I removed almost everything from the skeleton to leave only the app view (just like you did in your other example). I can't get lower than that. Give it a try.

ghiscoding commented 7 years ago

I'm done now, it looks exactly like your JSPM example, except that it's much faster to load :)

grofit commented 7 years ago

your example doesnt work when hosted, cannot find the bundle file :(

ghiscoding commented 7 years ago

Webpack is compiled at run time, there is not bundle unless you run it. It's probably somewhere local though, I'll take a look later

Yes so I checked, it's really like I said, compiled at run time and doesn't exist unless your npm start the project. Do you really need the bundle.js file? I can copy it via Chrome (page sources), if you really need it.

grofit commented 7 years ago

well currently if I try and browse your example online it blows up:

https://rawgit.com/grofit/aurelia-chart/master/examples-wp/index.html

and the error is a 404 on the bundle.js, so ideally I would just want that working however it should be run.

ghiscoding commented 7 years ago

For Webpack, you need to run it with npm start so that it bundles it at that time. So unless you have Node on your host that won't work. Or as I said earlier, we can maybe fake it, every time it starts, it creates a bundle.js file which seems to be temporary file which I could copy and send it to you.

grofit commented 7 years ago

Just look at how the current gulp script works, just add another step onto the build to output the webpack bundle, or alternatively just remove the wp specific example if it wont work in a hosted environment, currently the gulp script bundles the aurelia stuff via JSPM and that bundle is persisted in source control (as there is no better way of hosting it at the moment unless you persist all the jspm packages in SC which seems worse)

grofit commented 7 years ago

Have done some refactoring changes to slim stuff down and simplify it a bit more, so hopefully the next version should have examples in one place and should work online, although it is still not super nice, but like with JSPM there isnt much of a workaround other than bundling the bundle.

ghiscoding commented 7 years ago

Ok if that works then great :)

By the way, the reason of why I made the examples-wp is to represent mostly what I see on other Github Aurelia packages. They usually offer multiple versions (JSPM, WebPack, TypeScript) with different folder and package.json, just like the Aurelia Skeleton, you just go in the folder you want and build it yourself. This package Aurelia-Authentication Loopback Sample is a great example of that, there's 3 client folders (client, client-ts, client-wp) each representing a different way of building the example and are meant to give you a head start but aren't built or bundled, that's typically you to do it yourself.

If you want to host the example, then yes I agree, it's better simplified and already bundled.

Anyhow, I hope the example I gave will be beneficial. Cheers and thanks for the great package :)