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
Follow app/javascript/application.js convention from Rails 7 (#3156)
* Follow app/javascript/application.js convention from Rails 7
So it remains compatible with other bundler setups, like esbuild-rails.
* Drop the idea of default dependencies
We can add them via Rails 7 installers
* Ensure entrypoints are only available at the top level
* Cut words
* Remove test
* Use Ruby target for Rails 7
* Match Rails 7 requirement of minimum Ruby version 2.7
Copy file name to clipboardExpand all lines: README.md
+7-8
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@
11
11
Webpacker makes it easy to use the JavaScript pre-processor and bundler
12
12
[Webpack v5](https://webpack.js.org/)
13
13
to manage application-like JavaScript in Rails. It can coexist with the asset pipeline,
14
-
leaving Webpack responsible solely for app-like JavaScript, or it can be used exclusively, making it also responsible for images, fronts, and CSS as well.
14
+
leaving Webpack responsible solely for app-like JavaScript, or it can be used exclusively, making it also responsible for images, fronts, and CSS.
15
15
16
16
**NOTE:** The master branch now hosts the code for v6.x.x. Please refer to [5-x-stable](https://github.com/rails/webpacker/tree/5-x-stable) branch for 5.x documentation.
17
17
@@ -78,10 +78,10 @@ leaving Webpack responsible solely for app-like JavaScript, or it can be used ex
78
78
79
79
## Installation
80
80
81
-
You can configure a new Rails application with Webpacker right from the start using the `--webpack` option:
81
+
You can configure a new Rails application with Webpacker right from the start using the `-j webpack` option:
82
82
83
83
```bash
84
-
rails new myapp --webpack
84
+
rails new myapp -j webpack
85
85
```
86
86
87
87
Or you can add it later by changing your `Gemfile`:
@@ -113,11 +113,10 @@ yarn install
113
113
Once installed, you can start writing modern ES6-flavored JavaScript apps right away:
Copy file name to clipboardExpand all lines: docs/v6_upgrade.md
+7-8
Original file line number
Diff line number
Diff line change
@@ -12,13 +12,12 @@ This means you have to configure integration with frameworks yourself, but webpa
12
12
13
13
## How to upgrade to Webpacker 6
14
14
15
-
1. If your `source_path` is `app/javascript`, rename it to `app/packs`
16
-
2. If your `source_entry_path` is `packs`, rename it to `entrypoints`
17
-
3. Rename `config/webpack` to `config/webpack_old`
18
-
4. Rename `config/webpacker.yml` to `config/webpacker_old.yml`
19
-
5. Uninstall the current version of `webpack-dev-server`: `yarn remove webpack-dev-server`
20
-
6. Remove .browserslistrc from the root of your Rails app
21
-
7. Upgrade the Webpacker Ruby gem and NPM package
15
+
1. Move your `app/javascript/packs/application.js` to `app/javascript/application.js`
16
+
2. Rename `config/webpack` to `config/webpack_old`
17
+
3. Rename `config/webpacker.yml` to `config/webpacker_old.yml`
18
+
4. Uninstall the current version of `webpack-dev-server`: `yarn remove webpack-dev-server`
19
+
5. Remove .browserslistrc from the root of your Rails app
20
+
6. Upgrade the Webpacker Ruby gem and NPM package
22
21
23
22
Note: [Check the releases page to verify the latest version](https://github.com/rails/webpacker/releases), and make sure to install identical version numbers of webpacker gem and `@rails/webpacker` npm package. (Gems use a period and packages use a dot between the main version number and the beta version.)
24
23
@@ -41,7 +40,7 @@ Example going to a specific version:
41
40
bundle exec rails webpacker:install
42
41
```
43
42
44
-
7. Update API usage of the view helpers by changing `javascript_packs_with_chunks_tag` and `stylesheet_packs_with_chunks_tag` to `javascript_pack_tag` and `stylesheet_pack_tag`. Ensure that your layouts and views will only have **at most one call** to `javascript_pack_tag` or `stylesheet_pack_tag`. You can now pass multiple bundles to these view helper methods. If you fail to changes this, you may experience performance issues, and other bugs related to multiple copies of React, like [issue 2932](https://github.com/rails/webpacker/issues/2932). If you expose jquery globally with `expose-loader,` by using `import $ from "expose-loader?exposes=$,jQuery!jquery"` in your `app/packs/entrypoints/application.js`, pass the option `defer: false` to your `javascript_pack_tag`.
43
+
7. Update API usage of the view helpers by changing `javascript_packs_with_chunks_tag` and `stylesheet_packs_with_chunks_tag` to `javascript_pack_tag` and `stylesheet_pack_tag`. Ensure that your layouts and views will only have **at most one call** to `javascript_pack_tag` or `stylesheet_pack_tag`. You can now pass multiple bundles to these view helper methods. If you fail to changes this, you may experience performance issues, and other bugs related to multiple copies of React, like [issue 2932](https://github.com/rails/webpacker/issues/2932). If you expose jquery globally with `expose-loader,` by using `import $ from "expose-loader?exposes=$,jQuery!jquery"` in your `app/javascript/application.js`, pass the option `defer: false` to your `javascript_pack_tag`.
45
44
8. If you are using any integrations like `css`, `React` or `TypeScript`. Please see https://github.com/rails/webpacker#integrations section on how they work in v6.
46
45
9. Copy over any custom webpack config from `config/webpack_old`. Common code previously called 'environment' should be changed to 'base', and import `environment` changed to `webpackConfig`.
0 commit comments