Skip to content

Commit 2cc0aca

Browse files
Merge pull request rails#43152 from abhaynikam/update-webpacker-guides
Update webpacker guides after version upgrade [ci-skip]
2 parents 7ce6f45 + b7f67b4 commit 2cc0aca

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

guides/source/webpacker.md

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ To use Webpacker, you must install the Yarn package manager, version 1.x or up,
5151

5252
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 the installation and management of JavaScript dependencies, much like Bundler does for Ruby.
5353

54-
Webpacker is installed by default in Rails 6.0 and up. You can install it with a new project in some older versions by adding `--webpack` to the `rails new` command. Webpacker can be added in an existing project by running `bin/rails webpacker:install`. This installation command creates the following local files:
54+
To include Webpacker in a new project, add `--webpack` to the `rails new` command. To add Webpacker to an existing project, add the `webpacker` gem to the project's `Gemfile`, run `bundle install`, and then run `bin/rails webpacker:install`.
55+
56+
Installing Webpacker creates the following local files:
5557

5658
|File |Location |Explanation |
5759
|------------------------|------------------------|----------------------------------------------------------------------------------------------------|
@@ -64,28 +66,6 @@ Webpacker is installed by default in Rails 6.0 and up. You can install it with a
6466

6567
The installation also calls the `yarn` package manager, creates a `package.json` file with a basic set of packages listed, and uses Yarn to install these dependencies.
6668

67-
### Integrating Frameworks with Webpacker
68-
69-
Webpacker also contains support for many popular JavaScript frameworks and tools. Typically, these are installed either when the application is created with something like `rails new myapp --webpack=<framework_name>` or with a separate command-line task, like `rails webpacker:install:<framework_name>`.
70-
71-
These integrations typically install the set of NPM packages needed to get started with the framework or tool, a "hello world" page to show that it works, and any other webpack loaders or transformations needed to compile the tool. The supported frameworks and tools are:
72-
73-
INFO. It's possible to install frameworks not included in this list. These are basic integrations of popular choices.
74-
75-
|Framework |Install command |Description |
76-
|------------------|----------------------------------------|--------------------------------------------------|
77-
|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-
87-
For more information about the existing integrations, consult the [README](https://github.com/rails/webpacker#integrations).
88-
8969
Usage
9070
-----
9171

@@ -180,7 +160,7 @@ You can also access the image by directly referencing the file from a CSS file i
180160

181161
### Webpacker in Rails Engines
182162

183-
As of Webpacker version 5, Webpacker is not "engine-aware," which means Webpacker does not have feature-parity with Sprockets when it comes to using within Rails engines. The [Webpacker engine guides](https://github.com/rails/webpacker/blob/master/docs/engines.md) provide some detailed workarounds to add Webpacker-support and developing locally against an engine with Webpacker.
163+
As of Webpacker version 6, Webpacker is not "engine-aware," which means Webpacker does not have feature-parity with Sprockets when it comes to using within Rails engines.
184164

185165
Gem authors of Rails engines who wish to support consumers using Webpacker are encouraged to distribute frontend assets as an NPM package in addition to the gem itself and provide instructions (or an installer) to demonstrate how host apps should integrate. A good example of this approach is [Alchemy CMS](https://github.com/AlchemyCMS/alchemy_cms).
186166

0 commit comments

Comments
 (0)