新 Rails 应用程序中的“获取原始源时出错”(Sprockets 4、Firefox 70)

Jar*_*eck 7 firefox ruby-on-rails sprockets ruby-on-rails-6

sprockets 4.0.0 似乎与 Chrome 78 兼容,但与 Firefox 70 不兼容。

从一个新的 rails 应用程序开始:

rails -v # Rails 6.0.0
rails new helloworld
Run Code Online (Sandbox Code Playgroud)
# Gemfile
gem 'sass-rails', '~> 6' # not 5
Run Code Online (Sandbox Code Playgroud)
bundle | grep sprockets
Using sprockets 4.0.0
Using sprockets-rails 3.2.1
Run Code Online (Sandbox Code Playgroud)
# layouts/application.html.erb
javascript_include_tag 'application'
Run Code Online (Sandbox Code Playgroud)
# app/assets/javascripts/application.js
console.log('line 1');
throw 'line 2';
Run Code Online (Sandbox Code Playgroud)
# app/assets/config/manifest.js
//= link_directory ../javascripts .js
Run Code Online (Sandbox Code Playgroud)
# Dev tools console, Firefox 70
line 1 application.source.js:1
uncaught exception: line 2 application.source.js:2
Error while fetching an original source: "http://localhost:3000/assets/application.source.js" is not in the SourceMap.
Source URL: <unknown>
Run Code Online (Sandbox Code Playgroud)

在 Chrome 78 中运行良好