Skip to content

Commit 6a9f567

Browse files
authored
Merge pull request #834 from joeyparis/webpacker-manifest-asset-path
🐛 Fix bug that prevents loading assets with `webpacker-dev-server`
2 parents b3fac2c + 649b1b6 commit 6a9f567

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: lib/react/server_rendering/webpacker_manifest_container.rb

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def find_asset(logical_path)
4242
asset_path = Webpacker.manifest.lookup(logical_path).to_s
4343
if Webpacker.dev_server.running?
4444
ds = Webpacker.dev_server
45+
# Remove the protocol and host from the asset path. Sometimes webpacker includes this, sometimes it does not
46+
asset_path.slice!("#{ds.protocol}://#{ds.host_with_port}")
4547
dev_server_asset = open("#{ds.protocol}://#{ds.host_with_port}#{asset_path}").read
4648
dev_server_asset.sub!(CLIENT_REQUIRE, '//\0')
4749
dev_server_asset

0 commit comments

Comments
 (0)