@@ -5,9 +5,15 @@ module Webpacker::Helper
5
5
#
6
6
# Example:
7
7
#
8
+ # # In development mode with hot module replacement:
9
+ # <%= asset_pack_path 'calendar.css' %> # => nil
10
+ #
11
+ # # In production mode:
8
12
# <%= asset_pack_path 'calendar.css' %> # => "/packs/calendar-1016838bab065ae1e122.css"
9
13
def asset_pack_path ( name , **options )
10
- asset_path ( Webpacker . manifest . lookup! ( name ) , **options )
14
+ unless Webpacker . dev_server . running? && Webpacker . dev_server . hot_module_replacing?
15
+ asset_path ( Webpacker . manifest . lookup! ( name ) , **options )
16
+ end
11
17
end
12
18
13
19
# Computes the absolute path for a given Webpacker asset.
@@ -16,9 +22,15 @@ def asset_pack_path(name, **options)
16
22
#
17
23
# Example:
18
24
#
25
+ # # In development mode with hot module replacement:
26
+ # <%= asset_pack_url 'calendar.css' %> # => nil
27
+ #
28
+ # # In production mode:
19
29
# <%= asset_pack_url 'calendar.css' %> # => "http://example.com/packs/calendar-1016838bab065ae1e122.css"
20
30
def asset_pack_url ( name , **options )
21
- asset_url ( Webpacker . manifest . lookup! ( name ) , **options )
31
+ unless Webpacker . dev_server . running? && Webpacker . dev_server . hot_module_replacing?
32
+ asset_url ( Webpacker . manifest . lookup! ( name ) , **options )
33
+ end
22
34
end
23
35
24
36
# Creates a script tag that references the named pack file, as compiled by webpack per the entries list
0 commit comments