You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/source/webpacker.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,13 +36,13 @@ You should choose webpacker over Sprockets on a new project if you want to use N
36
36
37
37
If you are familiar with Sprockets, the following guide might give you some idea of how to translate. Please note that each tool has a slightly different structure, and the concepts don't directly map onto each other.
|Require a script |//= require |import or require |
46
46
47
47
Installing Webpacker
48
48
--------------------
@@ -51,7 +51,7 @@ To use Webpacker, you must install the Yarn package manager, version 1.x or up,
51
51
52
52
NOTE: Webpacker depends on NPM and Yarn. NPM, the Node package manager registry, is the primary repository for publishing and downloading open-source JavaScript projects, both for Node.js and browser runtimes. It is analogous to rubygems.org for Ruby gems. Yarn is a command-line utility that enables installation and management of JavaScript dependencies, much like Bundler does for Ruby.
53
53
54
-
Webpacker is installed by default in Rails 6.0 and up. In some older versions, you can install it with a new project by adding `--webpack` to the `rails new` command. In an existing project, webpacker can be added by running `bundle exec rails webpacker:install`. This installation command creates following local files:
54
+
Webpacker is installed by default in Rails 6.0 and up. In some older versions, you can install it with a new project by adding `--webpack` to the `rails new` command. In an existing project, webpacker can be added by running `bin/rails webpacker:install`. This installation command creates following local files:
|Angular |`bin/rails webpacker:install:angular`|Sets up Angular and Typescript |
78
+
|CoffeeScript |`bin/rails webpacker:install:coffee`|Sets up CoffeeScript |
79
+
|Elm |`bin/rails webpacker:install:elm`|Sets up Elm |
80
+
|ERB |`bin/rails webpacker:install:erb`|Sets up ERB support on your Javascript files |
81
+
|React |`bin/rails webpacker:install:react`|Sets up ReactJS |
82
+
|Stimulus |`bin/rails webpacker:install:stimulus`|Sets up StimulusJS |
83
+
|Svelte |`bin/rails webpacker:install:svelte`|Sets up Svelte JS |
84
+
|TypeScript |`bin/rails webpacker:install:typescript`|Sets up Typescript for your project using Babel's TypeScript support|
85
+
|Vue |`bin/rails webpacker:install:vue`|Sets up VueJS |
86
86
87
87
For more information about the existing integrations, see https://github.com/rails/webpacker#integrations
88
88
@@ -203,7 +203,7 @@ By default, Webpacker compiles automatically on demand in development when a Rai
203
203
204
204
If you want to use live code reloading, or you have enough JavaScript that on-demand compilation is too slow, you'll need to run `./bin/webpack-dev-server` or `ruby ./bin/webpack-dev-server`. This process will watch for changes in the `app/javascript/packs/*.js` files and automatically recompile and reload the browser to match.
205
205
206
-
Windows users will need to run these commands in a terminal separate from `bundle exec rails s`.
206
+
Windows users will need to run these commands in a terminal separate from `bundle exec rails server`.
207
207
208
208
Once you start this development server, Webpacker will automatically start proxying all webpack asset requests to this server. When you stop the server, it'll revert to on-demand compilation.
0 commit comments