Skip to content

Commit f27ec14

Browse files
committed
Spell out Rails dependencies manually
1 parent 30868a8 commit f27ec14

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ Importmap for Rails is automatically included in Rails 7+ for new applications,
1616

1717
Note: In order to use JavaScript from Rails frameworks like Action Cable, Action Text, and Active Storage, you must be running Rails 7.0+. This was the first version that shipped with ESM compatible builds of these libraries.
1818

19+
You can pin those libraries manually by relying on the compiled versions included in Rails like this:
20+
21+
```ruby
22+
pin "@rails/actioncable", to: "actioncable.esm.js"
23+
pin "@rails/activestorage", to: "activestorage.esm.js"
24+
pin "@rails/actiontext", to: "actiontext.esm.js"
25+
pin "trix"
26+
```
27+
1928
## How do importmaps work?
2029

2130
At their core, importmaps are essentially a string substitution for what are referred to as "bare module specifiers". A "bare module specifier" looks like this: `import React from "react"`. This is not compatible with the ES Module loader spec. Instead, to be ESM compatible, you must provide 1 of the 3 following types of specifiers:

0 commit comments

Comments
 (0)