I've been working on my application with webpack and so far things have been improving. It seems like none of my modules are corrupt. I must admit, I was quite surprised when this tool managed to shrink my 150mb React app down to 2mb, even though I don't fully understand how it works.
However, I've run into an issue where my images and a lot of my CSS are not loading properly. Here's an example:
<img class="searched-user-icon bump-icon" src="export default __webpack_public_path__ + &quot;src/static/pointingfinger.svg&quot;;" alt="pointingfinger">
When I inspect this element in the browser dev tools, I get a 404 error. But if I change it to this:
<img class="searched-user-icon bump-icon" src="src/static/pointingfinger.svg" alt="pointingfinger">
It works fine. I need to resolve this issue so that images display correctly after the build. In my React component files, I import images like this:
import pointingfinger from '../static/pointingfinger.svg';
I couldn't find much information on this peculiar behavior. If someone understands what's going on, I would appreciate an explanation. Also, I'd like to automatically copy my CSS based on where the CSS file is located relative to the build time, similar to how I'm using file-loader. Manually setting up a system to consolidate all CSS files seems less flexible. Below is my webpack configuration:
(webpack config here)
edit: It seems the configuration doesn't like me referencing sources like this
<img src={pointingfinger}></img>
in my code. Perhaps a simple plugin will solve the issue. I'll update once I find a solution.
edit2: Trying out the "plugin-transform-react-jsx" plugin doesn't appear to be resolving the problem.