Vheissu / aurelia-for-real-world-web-applications-book-feedback

Post feedback as issues here on Github for the Aurelia book. Be as descriptive and honest as you like.
15 stars 0 forks source link

Using images with webpack #75

Closed tobias-kuendig closed 7 years ago

tobias-kuendig commented 8 years ago

In the chapter Working With Webpack under Caveats you write

You will also most likely encounter some issues with paths, mostly relative paths. My experiences with using Webpack is image paths break and require adjustment, the same thing for style imports and fonts as well.

It would be awesome to get some troubleshooting tips in this section.

I'm currently completely lost on how to use images with webpack in Aurelia. Most of the examples you find online are for react, where you simply use <img src="' + require('img.jpg') + '" /> This is not possible in Aurelia.

It would be great to have examples on...

  1. How to make Webpack copy your assets over to dist when bundling
  2. How to properly import images and use them in the view
  3. How to fix problems with relative paths
Vheissu commented 8 years ago

Absolutely. I have been getting a few questions via email about Webpack usage, I'll add in some troubleshooting tips for developers like yourself wanting to use Webpack, maybe even code samples and whatnot.

Vheissu commented 8 years ago

Changes to the webpack plugin which the Aurelia team are working on means that some of the issues around images are fixed when that stuff stabilises. However, I'll be writing up something anyway for situations where Aurelia won't cover you.

Vheissu commented 8 years ago

The latest plugin addresses some of the image path issues as paths are now checked upon compile time using the latest version of the Webpack Plugin. Still some stuff to write about on this though.

Vheissu commented 7 years ago

Latest Webpack plugin handles images to the point where I didn't actually need to add anything into the book. Closing this for now.