Skip to content

Commit 4aa297f

Browse files
committed
Tweak dev-server detector
1 parent 9390b09 commit 4aa297f

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

test/support/webpacker_helpers.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,18 @@ def with_dev_server
9898
next
9999
end
100100
# Make sure the dev server is up:
101-
file = open("http://localhost:8080/packs/application.js")
102-
if !example_asset_path.start_with?("http://localhost:8080") && ! file
103-
raise "Manifest doesn't include absolute path to dev server"
101+
if MAJOR < 3
102+
file = open("http://localhost:8080/packs/application.js")
103+
if !example_asset_path.start_with?("http://localhost:8080") && ! file
104+
raise "Manifest doesn't include absolute path to dev server"
105+
end
106+
else
107+
# Webpacker proxies the dev server when Rails is running in Webpacker 3
108+
# so the manifest doens't have absolute paths anymore..
109+
file = open("http://localhost:8080#{example_asset_path}")
110+
if ! file
111+
raise "Webpack Dev Server hasn't started yet"
112+
end
104113
end
105114

106115
detected_dev_server = true

0 commit comments

Comments
 (0)