Skip to content

Commit 2dbcb3d

Browse files
committed
fix using actiontext.js in sprocket
actiontext.js is compiled as ESM bundle instead of UMD bundle. This leads to issues when trying to use ActionText with sprockets because the ESM bundle declares variables like they are scoped to the file but sprockets will see them as scoped globally. This is a problem, in particular, if you want to mix actiontext with turbo-rails. The problem got introduced in rails#46447. I traced valid compilation back to rails#42895. This commit mimic changes made in rails#42895 to ActiveStorage: Retains app/assets/javascripts/actiontext.js as a UMD package for backwards compatibility with bundling in the asset pipeline, but also adds app/assets/javascripts/actiontext.esm.js for use with ESM via importmap in the browser.
1 parent 488a7ce commit 2dbcb3d

File tree

10 files changed

+1736
-847
lines changed

10 files changed

+1736
-847
lines changed

actiontext/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
* Compile ESM package that can be used directly in the browser as actiontext.esm.js
2+
3+
*Matias Grunberg*
4+
5+
* Fix using actiontext.js with Sprockets
6+
7+
*Matias Grunberg*
8+
19
* Upgrade Trix to 2.0.7
210

311
*Hartley McGuire*
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
actiontext.js linguist-generated
2+
actiontext.esm.js linguist-generated
23
trix.js linguist-vendored

0 commit comments

Comments
 (0)