Skip to content

Commit 146f0e7

Browse files
Merge pull request rails#41507 from tiramizoo/adjust-webpacker-guide
Adjust application pack in webpacker guide [ci-skip]
2 parents b90875e + 6d0773a commit 146f0e7

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)