Skip to content

Commit 6d0773a

Browse files
committed
Adjust application pack in webpacker guide
This is how it looks like when generated in the new app (via Rails 6.1.3) [ci skip]
1 parent b90875e commit 6d0773a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

guides/source/webpacker.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,14 @@ So if you have a file called `app/javascript/packs/application.js`, Webpacker wi
9898
The default pack created for you by Webpacker will link to Rails default JavaScript packages if they have been included in the project:
9999

100100
```
101-
require("@rails/ujs").start()
102-
require("turbolinks").start()
103-
require("@rails/activestorage").start()
104-
require("channels")
101+
import Rails from "@rails/ujs"
102+
import Turbolinks from "turbolinks"
103+
import * as ActiveStorage from "@rails/activestorage"
104+
import "channels"
105+
106+
Rails.start()
107+
Turbolinks.start()
108+
ActiveStorage.start()
105109
```
106110

107111
You'll need to include a pack that requires these packages to use them in your Rails application.

0 commit comments

Comments
 (0)