Webpack's publicPath isn't used #1520

Closed
opened 2025-08-09 17:20:27 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @Tragetaschen on 7/13/2016

I'm using the html-loader for my angular 2 templates and that replaces for example <img src> paths with their server path. When I'm running my app in the browser, the publicPath is correctly used as expected. When running on the server, there is no publicPath at all (__webpack_require__.p seems to be the empty string / null / undefined).
That means, my browser renders <img src="/dist/9a08c41631a395a808e4d9d7b7b68d63.jpg"/>, the server just renders <img src="9a08c41631a395a808e4d9d7b7b68d63.jpg"/>.

*Originally created by @Tragetaschen on 7/13/2016* I'm using the html-loader for my angular 2 templates and that replaces for example `<img src>` paths with their server path. When I'm running my app in the browser, the publicPath is correctly used as expected. When running on the server, there is no publicPath at all (`__webpack_require__.p` seems to be the empty string / null / undefined). That means, my browser renders `<img src="/dist/9a08c41631a395a808e4d9d7b7b68d63.jpg"/>`, the server just renders `<img src="9a08c41631a395a808e4d9d7b7b68d63.jpg"/>`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1520
No description provided.