webpacker 4.2.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.node-version +1 -1
  3. data/.travis.yml +7 -20
  4. data/CHANGELOG.md +90 -55
  5. data/Gemfile +1 -0
  6. data/Gemfile.lock +8 -5
  7. data/README.md +52 -280
  8. data/docs/css.md +3 -4
  9. data/docs/deployment.md +2 -2
  10. data/docs/docker.md +17 -17
  11. data/docs/engines.md +13 -0
  12. data/docs/env.md +0 -2
  13. data/docs/integrations.md +220 -0
  14. data/docs/testing.md +1 -2
  15. data/docs/typescript.md +4 -21
  16. data/lib/install/config/webpacker.yml +0 -4
  17. data/lib/install/examples/react/tsconfig.json +2 -1
  18. data/lib/install/examples/typescript/tsconfig.json +2 -1
  19. data/lib/install/loaders/svelte.js +2 -2
  20. data/lib/install/template.rb +2 -2
  21. data/lib/install/typescript.rb +8 -12
  22. data/lib/tasks/webpacker/check_node.rake +14 -7
  23. data/lib/tasks/webpacker/check_yarn.rake +16 -9
  24. data/lib/tasks/webpacker/clean.rake +16 -6
  25. data/lib/tasks/webpacker/clobber.rake +8 -4
  26. data/lib/tasks/webpacker/compile.rake +1 -9
  27. data/lib/tasks/webpacker/yarn_install.rake +5 -16
  28. data/lib/webpacker.rb +8 -0
  29. data/lib/webpacker/commands.rb +45 -19
  30. data/lib/webpacker/compiler.rb +2 -3
  31. data/lib/webpacker/configuration.rb +1 -5
  32. data/lib/webpacker/dev_server_proxy.rb +3 -1
  33. data/lib/webpacker/dev_server_runner.rb +4 -4
  34. data/lib/webpacker/helper.rb +8 -8
  35. data/lib/webpacker/manifest.rb +4 -4
  36. data/lib/webpacker/railtie.rb +0 -43
  37. data/lib/webpacker/version.rb +1 -1
  38. data/package.json +35 -35
  39. data/package/__tests__/dev_server.js +2 -0
  40. data/package/dev_server.js +1 -1
  41. data/package/environments/__tests__/base.js +10 -0
  42. data/package/environments/base.js +12 -1
  43. data/package/environments/development.js +0 -4
  44. data/package/rules/babel.js +1 -1
  45. data/package/rules/sass.js +7 -1
  46. data/test/manifest_test.rb +37 -6
  47. data/test/rake_tasks_test.rb +11 -0
  48. data/test/test_app/app/javascript/packs/multi_entry.css +4 -0
  49. data/test/test_app/app/javascript/packs/multi_entry.js +4 -0
  50. data/test/test_app/config/application.rb +0 -1
  51. data/webpacker.gemspec +4 -3
  52. data/yarn.lock +2627 -1547
  53. metadata +28 -13
  54. data/gemfiles/Gemfile-rails.4.2.x +0 -9
  55. data/gemfiles/Gemfile-rails.5.0.x +0 -9
  56. data/gemfiles/Gemfile-rails.5.1.x +0 -9
  57. data/lib/install/loaders/typescript.js +0 -11
@@ -1,7 +1,7 @@
1
1
  # Install Webpacker
2
2
  copy_file "#{__dir__}/config/webpacker.yml", "config/webpacker.yml"
3
3
 
4
- puts "Copying webpack core config"
4
+ say "Copying webpack core config"
5
5
  directory "#{__dir__}/config/webpack", "config/webpack"
6
6
 
7
7
  say "Copying postcss.config.js to app root directory"
@@ -36,7 +36,7 @@ end
36
36
 
37
37
  if Webpacker::VERSION =~ /^[0-9]+\.[0-9]+\.[0-9]+$/
38
38
  say "Installing all JavaScript dependencies [#{Webpacker::VERSION}]"
39
- run "yarn add @rails/webpacker"
39
+ run "yarn add @rails/webpacker@#{Webpacker::VERSION}"
40
40
  else
41
41
  say "Installing all JavaScript dependencies [from prerelease rails/webpacker]"
42
42
  run "yarn add @rails/webpacker@next"
@@ -15,17 +15,10 @@ if File.exist?(package_json)
15
15
  end
16
16
  end
17
17
 
18
- say "Copying typescript loader to config/webpack/loaders"
19
- copy_file "#{__dir__}/loaders/typescript.js", Rails.root.join("config/webpack/loaders/typescript.js").to_s
20
-
21
- say "Adding typescript loader to config/webpack/environment.js"
22
- insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
23
- "const typescript = require('./loaders/typescript')\n",
24
- after: /require\(('|")@rails\/webpacker\1\);?\n/
25
-
26
- insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
27
- "environment.loaders.prepend('typescript', typescript)\n",
28
- before: "module.exports"
18
+ say "Adding TypeScript preset to babel.config.js"
19
+ insert_into_file Rails.root.join("babel.config.js").to_s,
20
+ ",\n ['@babel/preset-typescript', { 'allExtensions': true, 'isTSX': true }]",
21
+ before: /\s*\].filter\(Boolean\),\n\s*plugins: \[/
29
22
 
30
23
  say "Copying tsconfig.json to the Rails root directory for typescript"
31
24
  copy_file "#{__dir__}/examples/#{example_source}/tsconfig.json", "tsconfig.json"
@@ -41,6 +34,9 @@ copy_file "#{__dir__}/examples/typescript/hello_typescript.ts",
41
34
  "#{Webpacker.config.source_entry_path}/hello_typescript.ts"
42
35
 
43
36
  say "Installing all typescript dependencies"
44
- run "yarn add typescript ts-loader #{additional_packages}"
37
+ run "yarn add typescript #{additional_packages}"
38
+
39
+ say "Installing all typescript dev-dependencies"
40
+ run "yarn add @babel/preset-typescript babel-preset-typescript-vue -D"
45
41
 
46
42
  say "Webpacker now supports typescript 🎉", :green
@@ -1,3 +1,4 @@
1
+ require "semantic_range"
1
2
  namespace :webpacker do
2
3
  desc "Verifies if Node.js is installed"
3
4
  task :check_node do
@@ -6,19 +7,25 @@ namespace :webpacker do
6
7
  raise Errno::ENOENT if node_version.blank?
7
8
 
8
9
  pkg_path = Pathname.new("#{__dir__}/../../../package.json").realpath
9
- node_requirement = JSON.parse(pkg_path.read)["engines"]["node"]
10
+ node_range = JSON.parse(pkg_path.read)["engines"]["node"]
11
+ is_valid = SemanticRange.satisfies?(node_version, node_range) rescue false
12
+ semver_major = node_version[/\d+/] rescue nil
13
+ is_unstable = semver_major.to_i.odd? rescue false
10
14
 
11
- requirement = Gem::Requirement.new(node_requirement)
12
- version = Gem::Version.new(node_version.strip.tr("v", ""))
15
+ if is_unstable
16
+ $stderr.puts "Warning: you are using an unstable release of Node.js (#{node_version}). If you encounter issues with Node.js, consider switching to an Active LTS release. More info: https://docs.npmjs.com/try-the-latest-stable-version-of-node"
17
+ end
13
18
 
14
- unless requirement.satisfied_by?(version)
15
- $stderr.puts "Webpacker requires Node.js #{requirement} and you are using #{version}"
19
+ unless is_valid
20
+ $stderr.puts "Webpacker requires Node.js \"#{node_range}\" and you are using #{node_version}"
16
21
  $stderr.puts "Please upgrade Node.js https://nodejs.org/en/download/"
17
- $stderr.puts "Exiting!" && exit!
22
+ $stderr.puts "Exiting!"
23
+ exit!
18
24
  end
19
25
  rescue Errno::ENOENT
20
26
  $stderr.puts "Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/"
21
- $stderr.puts "Exiting!" && exit!
27
+ $stderr.puts "Exiting!"
28
+ exit!
22
29
  end
23
30
  end
24
31
  end
@@ -1,3 +1,4 @@
1
+ require "semantic_range"
1
2
  namespace :webpacker do
2
3
  desc "Verifies if Yarn is installed"
3
4
  task :check_yarn do
@@ -6,19 +7,25 @@ namespace :webpacker do
6
7
  raise Errno::ENOENT if yarn_version.blank?
7
8
 
8
9
  pkg_path = Pathname.new("#{__dir__}/../../../package.json").realpath
9
- yarn_requirement = JSON.parse(pkg_path.read)["engines"]["yarn"]
10
+ yarn_range = JSON.parse(pkg_path.read)["engines"]["yarn"]
11
+ is_valid = SemanticRange.satisfies?(yarn_version, yarn_range) rescue false
12
+ is_unsupported = SemanticRange.satisfies?(yarn_version, ">=2.0.0") rescue false
10
13
 
11
- requirement = Gem::Requirement.new(yarn_requirement)
12
- version = Gem::Version.new(yarn_version)
13
-
14
- unless requirement.satisfied_by?(version)
15
- $stderr.puts "Webpacker requires Yarn #{requirement} and you are using #{version}"
16
- $stderr.puts "Please upgrade Yarn https://yarnpkg.com/lang/en/docs/install/"
17
- $stderr.puts "Exiting!" && exit!
14
+ unless is_valid
15
+ $stderr.puts "Webpacker requires Yarn \"#{yarn_range}\" and you are using #{yarn_version}"
16
+ if is_unsupported
17
+ $stderr.puts "This version of Webpacker does not support Yarn #{yarn_version}. Please downgrade to a supported version of Yarn https://yarnpkg.com/lang/en/docs/install/"
18
+ $stderr.puts "For information on using Webpacker with Yarn 2.0, see https://github.com/rails/webpacker/issues/2112"
19
+ else
20
+ $stderr.puts "Please upgrade Yarn https://yarnpkg.com/lang/en/docs/install/"
21
+ end
22
+ $stderr.puts "Exiting!"
23
+ exit!
18
24
  end
19
25
  rescue Errno::ENOENT
20
26
  $stderr.puts "Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/"
21
- $stderr.puts "Exiting!" && exit!
27
+ $stderr.puts "Exiting!"
28
+ exit!
22
29
  end
23
30
  end
24
31
  end
@@ -1,15 +1,25 @@
1
+ $stdout.sync = true
2
+
1
3
  require "webpacker/configuration"
2
4
 
3
5
  namespace :webpacker do
4
6
  desc "Remove old compiled webpacks"
5
- task :clean, [:keep] => ["webpacker:verify_install", :environment] do |_, args|
6
- Webpacker.clean(Integer(args.keep || 2))
7
+ task :clean, [:keep, :age] => ["webpacker:verify_install", :environment] do |_, args|
8
+ Webpacker.ensure_log_goes_to_stdout do
9
+ Webpacker.clean(Integer(args.keep || 2), Integer(args.age || 3600))
10
+ end
7
11
  end
8
12
  end
9
13
 
10
- # Run clean if the assets:clean is run
11
- if Rake::Task.task_defined?("assets:clean")
12
- Rake::Task["assets:clean"].enhance do
13
- Rake::Task["webpacker:clean"].invoke
14
+ skip_webpacker_clean = %w(no false n f).include?(ENV["WEBPACKER_PRECOMPILE"])
15
+
16
+ unless skip_webpacker_clean
17
+ # Run clean if the assets:clean is run
18
+ if Rake::Task.task_defined?("assets:clean")
19
+ Rake::Task["assets:clean"].enhance do
20
+ Rake::Task["webpacker:clean"].invoke
21
+ end
22
+ else
23
+ Rake::Task.define_task("assets:clean" => "webpacker:clean")
14
24
  end
15
25
  end
@@ -8,9 +8,13 @@ namespace :webpacker do
8
8
  end
9
9
  end
10
10
 
11
- # Run clobber if the assets:clobber is run
12
- if Rake::Task.task_defined?("assets:clobber")
13
- Rake::Task["assets:clobber"].enhance do
14
- Rake::Task["webpacker:clobber"].invoke
11
+ skip_webpacker_clobber = %w(no false n f).include?(ENV["WEBPACKER_PRECOMPILE"])
12
+
13
+ unless skip_webpacker_clobber
14
+ # Run clobber if the assets:clobber is run
15
+ if Rake::Task.task_defined?("assets:clobber")
16
+ Rake::Task["assets:clobber"].enhance do
17
+ Rake::Task["webpacker:clobber"].invoke
18
+ end
15
19
  end
16
20
  end
@@ -1,13 +1,5 @@
1
1
  $stdout.sync = true
2
2
 
3
- def ensure_log_goes_to_stdout
4
- old_logger = Webpacker.logger
5
- Webpacker.logger = ActiveSupport::Logger.new(STDOUT)
6
- yield
7
- ensure
8
- Webpacker.logger = old_logger
9
- end
10
-
11
3
  def yarn_install_available?
12
4
  rails_major = Rails::VERSION::MAJOR
13
5
  rails_minor = Rails::VERSION::MINOR
@@ -27,7 +19,7 @@ namespace :webpacker do
27
19
  desc "Compile JavaScript packs using webpack for production with digests"
28
20
  task compile: ["webpacker:verify_install", :environment] do
29
21
  Webpacker.with_node_env(ENV.fetch("NODE_ENV", "production")) do
30
- ensure_log_goes_to_stdout do
22
+ Webpacker.ensure_log_goes_to_stdout do
31
23
  if Webpacker.compile
32
24
  # Successful compilation!
33
25
  else
@@ -1,21 +1,10 @@
1
1
  namespace :webpacker do
2
2
  desc "Support for older Rails versions. Install all JavaScript dependencies as specified via Yarn"
3
3
  task :yarn_install do
4
- system "yarn install --no-progress"
5
-
6
- exit(1) unless $?.success?
4
+ valid_node_envs = %w[test development production]
5
+ node_env = ENV.fetch("NODE_ENV") do
6
+ valid_node_envs.include?(Rails.env) ? Rails.env : "production"
7
+ end
8
+ system({ "NODE_ENV" => node_env }, "yarn install --no-progress --frozen-lockfile")
7
9
  end
8
10
  end
9
-
10
- def enhance_yarn_install
11
- Rake::Task["yarn:install"].enhance do
12
- exit(1) unless $?.success?
13
- end
14
- end
15
-
16
- if Rake::Task.task_defined?("yarn:install")
17
- enhance_yarn_install
18
- else
19
- # this is mainly for pre-5.x era
20
- Rake::Task.define_task("yarn:install" => "webpacker:yarn_install")
21
- end
@@ -22,6 +22,14 @@ module Webpacker
22
22
  ENV["NODE_ENV"] = original
23
23
  end
24
24
 
25
+ def ensure_log_goes_to_stdout
26
+ old_logger = Webpacker.logger
27
+ Webpacker.logger = ActiveSupport::Logger.new(STDOUT)
28
+ yield
29
+ ensure
30
+ Webpacker.logger = old_logger
31
+ end
32
+
25
33
  delegate :logger, :logger=, :env, to: :instance
26
34
  delegate :config, :compiler, :manifest, :commands, :dev_server, to: :instance
27
35
  delegate :bootstrap, :clean, :clobber, :compile, to: :commands
@@ -1,25 +1,41 @@
1
1
  class Webpacker::Commands
2
- delegate :config, :compiler, :manifest, to: :@webpacker
2
+ delegate :config, :compiler, :manifest, :logger, to: :@webpacker
3
3
 
4
4
  def initialize(webpacker)
5
5
  @webpacker = webpacker
6
6
  end
7
7
 
8
- def clean(count_to_keep = 2)
8
+ # Cleanup old assets in the compile directory. By default it will
9
+ # keep the latest version, 2 backups created within the past hour.
10
+ #
11
+ # Examples
12
+ #
13
+ # To force only 1 backup to be kept, set count=1 and age=0.
14
+ #
15
+ # To only keep files created within the last 10 minutes, set count=0 and
16
+ # age=600.
17
+ #
18
+ def clean(count = 2, age = 3600)
9
19
  if config.public_output_path.exist? && config.public_manifest_path.exist?
10
- files_in_manifest = process_manifest_hash(manifest.refresh)
11
- files_to_be_removed = files_in_manifest.flat_map do |file_in_manifest|
12
- file_prefix, file_ext = file_in_manifest.scan(/(.*)[0-9a-f]{20}(.*)/).first
13
- versions_of_file = Dir.glob("#{file_prefix}*#{file_ext}").grep(/#{file_prefix}[0-9a-f]{20}#{file_ext}/)
14
- versions_of_file.map do |version_of_file|
15
- next if version_of_file == file_in_manifest
16
-
17
- [version_of_file, File.mtime(version_of_file).utc.to_i]
18
- end.compact.sort_by(&:last).reverse.drop(count_to_keep).map(&:first)
19
- end
20
-
21
- files_to_be_removed.each { |f| File.delete f }
20
+ versions
21
+ .sort
22
+ .reverse
23
+ .each_with_index
24
+ .drop_while do |(mtime, _), index|
25
+ max_age = [0, Time.now - Time.at(mtime)].max
26
+ max_age < age && index < count
27
+ end
28
+ .each do |(_, files), index|
29
+ files.each do |file|
30
+ if File.file?(file)
31
+ File.delete(file)
32
+ logger.info "Removed #{file}"
33
+ end
34
+ end
35
+ end
22
36
  end
37
+
38
+ true
23
39
  end
24
40
 
25
41
  def clobber
@@ -38,11 +54,21 @@ class Webpacker::Commands
38
54
  end
39
55
 
40
56
  private
41
- def process_manifest_hash(manifest_hash)
42
- manifest_hash.values.map do |value|
43
- next process_manifest_hash(value) if value.is_a?(Hash)
57
+ def versions
58
+ all_files = Dir.glob("#{config.public_output_path}/**/*")
59
+ manifest_config = Dir.glob("#{config.public_manifest_path}*")
60
+
61
+ packs = all_files - manifest_config - current_version
62
+ packs.reject { |file| File.directory?(file) }.group_by { |file| File.mtime(file).utc.to_i }
63
+ end
64
+
65
+ def current_version
66
+ packs = manifest.refresh.values.map do |value|
67
+ next if value.is_a?(Hash)
68
+
69
+ File.join(config.root_path, "public", "#{value}*")
70
+ end.compact
44
71
 
45
- File.join(config.root_path, "public", value)
46
- end.flatten
72
+ Dir.glob(packs).uniq
47
73
  end
48
74
  end
@@ -20,9 +20,8 @@ class Webpacker::Compiler
20
20
  if stale?
21
21
  run_webpack.tap do |success|
22
22
  # We used to only record the digest on success
23
- # However, the output file is still written on error, (at least with ts-loader), meaning that the
24
- # digest should still be updated. If it's not, you can end up in a situation where a recompile doesn't
25
- # take place when it should.
23
+ # However, the output file is still written on error, meaning that the digest should still be updated.
24
+ # If it's not, you can end up in a situation where a recompile doesn't take place when it should.
26
25
  # See https://github.com/rails/webpacker/issues/2113
27
26
  record_compilation_digest
28
27
  end
@@ -64,11 +64,7 @@ class Webpacker::Configuration
64
64
  end
65
65
 
66
66
  def check_yarn_integrity=(value)
67
- data[:check_yarn_integrity] = value
68
- end
69
-
70
- def check_yarn_integrity?
71
- fetch(:check_yarn_integrity)
67
+ warn "Webpacker::Configuration#check_yarn_integrity=(value) has been deprecated. The integrity check has been removed from Webpacker so changing this setting will have no effect."
72
68
  end
73
69
 
74
70
  def webpack_compile_output?
@@ -11,7 +11,9 @@ class Webpacker::DevServerProxy < Rack::Proxy
11
11
 
12
12
  def perform_request(env)
13
13
  if env["PATH_INFO"].start_with?("/#{public_output_uri_path}") && dev_server.running?
14
- env["HTTP_HOST"] = env["HTTP_X_FORWARDED_HOST"] = env["HTTP_X_FORWARDED_SERVER"] = dev_server.host_with_port
14
+ env["HTTP_HOST"] = env["HTTP_X_FORWARDED_HOST"] = dev_server.host
15
+ env["HTTP_X_FORWARDED_SERVER"] = dev_server.host_with_port
16
+ env["HTTP_PORT"] = env["HTTP_X_FORWARDED_PORT"] = dev_server.port.to_s
15
17
  env["HTTP_X_FORWARDED_PROTO"] = env["HTTP_X_FORWARDED_SCHEME"] = dev_server.protocol
16
18
  unless dev_server.https?
17
19
  env["HTTPS"] = env["HTTP_X_FORWARDED_SSL"] = "off"
@@ -16,20 +16,20 @@ module Webpacker
16
16
  def load_config
17
17
  app_root = Pathname.new(@app_path)
18
18
 
19
- config = Configuration.new(
19
+ @config = Configuration.new(
20
20
  root_path: app_root,
21
21
  config_path: app_root.join("config/webpacker.yml"),
22
22
  env: ENV["RAILS_ENV"]
23
23
  )
24
24
 
25
- dev_server = DevServer.new(config)
25
+ dev_server = DevServer.new(@config)
26
26
 
27
27
  @hostname = dev_server.host
28
28
  @port = dev_server.port
29
29
  @pretty = dev_server.pretty?
30
30
 
31
31
  rescue Errno::ENOENT, NoMethodError
32
- $stdout.puts "webpack dev_server configuration not found in #{config.config_path}[#{ENV["RAILS_ENV"]}]."
32
+ $stdout.puts "webpack dev_server configuration not found in #{@config.config_path}[#{ENV["RAILS_ENV"]}]."
33
33
  $stdout.puts "Please run bundle exec rails webpacker:install to install Webpacker"
34
34
  exit!
35
35
  end
@@ -39,7 +39,7 @@ module Webpacker
39
39
  server.close
40
40
 
41
41
  rescue Errno::EADDRINUSE
42
- $stdout.puts "Another program is running on port #{@port}. Set a new port in #{@config_file} for dev_server"
42
+ $stdout.puts "Another program is running on port #{@port}. Set a new port in #{@config.config_path} for dev_server"
43
43
  exit!
44
44
  end
45
45
 
@@ -7,8 +7,8 @@ module Webpacker::Helper
7
7
  end
8
8
 
9
9
  # Computes the relative path for a given Webpacker asset.
10
- # Returns the relative path using manifest.json and passes it to asset_path helper.
11
- # This will use asset_path internally, so most of their behaviors will be the same.
10
+ # Returns the relative path using manifest.json and passes it to path_to_asset helper.
11
+ # This will use path_to_asset internally, so most of their behaviors will be the same.
12
12
  #
13
13
  # Example:
14
14
  #
@@ -19,13 +19,13 @@ module Webpacker::Helper
19
19
  # <%= asset_pack_path 'calendar.css' %> # => "/packs/calendar-1016838bab065ae1e122.css"
20
20
  def asset_pack_path(name, **options)
21
21
  if current_webpacker_instance.config.extract_css? || !stylesheet?(name)
22
- asset_path(current_webpacker_instance.manifest.lookup!(name), options)
22
+ path_to_asset(current_webpacker_instance.manifest.lookup!(name), options)
23
23
  end
24
24
  end
25
25
 
26
26
  # Computes the absolute path for a given Webpacker asset.
27
- # Returns the absolute path using manifest.json and passes it to asset_url helper.
28
- # This will use asset_url internally, so most of their behaviors will be the same.
27
+ # Returns the absolute path using manifest.json and passes it to url_to_asset helper.
28
+ # This will use url_to_asset internally, so most of their behaviors will be the same.
29
29
  #
30
30
  # Example:
31
31
  #
@@ -36,7 +36,7 @@ module Webpacker::Helper
36
36
  # <%= asset_pack_url 'calendar.css' %> # => "http://example.com/packs/calendar-1016838bab065ae1e122.css"
37
37
  def asset_pack_url(name, **options)
38
38
  if current_webpacker_instance.config.extract_css? || !stylesheet?(name)
39
- asset_url(current_webpacker_instance.manifest.lookup!(name), options)
39
+ url_to_asset(current_webpacker_instance.manifest.lookup!(name), options)
40
40
  end
41
41
  end
42
42
 
@@ -169,8 +169,8 @@ module Webpacker::Helper
169
169
 
170
170
  def resolve_path_to_image(name)
171
171
  path = name.starts_with?("media/images/") ? name : "media/images/#{name}"
172
- asset_path(current_webpacker_instance.manifest.lookup!(path))
172
+ path_to_asset(current_webpacker_instance.manifest.lookup!(path))
173
173
  rescue
174
- asset_path(current_webpacker_instance.manifest.lookup!(name))
174
+ path_to_asset(current_webpacker_instance.manifest.lookup!(name))
175
175
  end
176
176
  end