DEV: Use absolute path for popper.js sourcemap (#11762)

This commit is contained in:
Penar Musaraj 2021-01-20 08:59:34 -05:00 committed by GitHub
parent 7f7bae1262
commit a9dfc5a547
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -314,6 +314,16 @@ task 'javascript:update' => 'clean_up' do
else else
FileUtils.cp_r(src, dest) FileUtils.cp_r(src, dest)
end end
# use absolute path for popper.js's sourcemap
# avoids noisy console warnings in dev environment for non-homepage paths
if dest.end_with? "popper.js"
File.open(dest) do |file|
contents = file.read
contents.gsub!("sourceMappingURL=popper", "sourceMappingURL=/popper")
File.open(dest, "w+") { |d| d.write(contents) }
end
end
end end
write_template("discourse/app/lib/public-js-versions.js", "update", <<~JS) write_template("discourse/app/lib/public-js-versions.js", "update", <<~JS)

View File

@ -1731,4 +1731,4 @@
Object.defineProperty(exports, '__esModule', { value: true }); Object.defineProperty(exports, '__esModule', { value: true });
}))); })));
//# sourceMappingURL=popper.js.map //# sourceMappingURL=/popper.js.map