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: docs/v6_upgrade.md
+20-2Lines changed: 20 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,21 @@ Webpacker used to configure Webpack indirectly, which lead to a [complicated sec
10
10
11
11
This means you have to configure integration with frameworks yourself, but webpack-merge helps with this. See this example for [Vue](https://github.com/rails/webpacker#other-frameworks).
12
12
13
-
## How to upgrade to Webpacker 6
13
+
## How to upgrade to Webpacker v6 from v5
14
+
1. If you are changing from the v5 default for `source_entry_path`:
15
+
```yml
16
+
source_path: app/javascript
17
+
source_entry_path: packs
18
+
```
19
+
to the v6 default:
20
+
```yml
21
+
source_path: app/javascript
22
+
source_entry_path: /
23
+
```
24
+
Then move your `app/javascript/packs/*` (including `application.js`) to `app/javascript/`.
25
+
26
+
Check if you had any entry point files in child directories of your `source_entry_path`. Files for entry points in child directories are not supported by rails/webpacker v6.
14
27
15
-
1. Move your `app/javascript/packs/application.js` to `app/javascript/application.js`
16
28
2. Rename `config/webpack` to `config/webpack_old`
17
29
3. Rename `config/webpacker.yml` to `config/webpacker_old.yml`
18
30
4. Uninstall the current version of `webpack-dev-server`: `yarn remove webpack-dev-server`
@@ -75,3 +87,9 @@ Example going to a specific version:
75
87
14. Some dependencies were removed in [PR 3056](https://github.com/rails/webpacker/pull/3056). If you see the error: `Error: Cannot find module 'babel-plugin-macros'`, or similar, then you need to `yarn add <dependency>` where <dependency> might include: `babel-plugin-macros`, `case-sensitive-paths-webpack-plugin`, `core-js`, `regenerator-runtime`. Or you might want to remove your dependency on those.
76
88
15. If you run `RAILS_ENV=production rake assets:precompile`, you may get an error that `bin/yarn` does not exist. Copy the file [bin/yarn](https://github.com/rails/webpacker/blob/master/lib/install/bin/yarn) to your `/bin` directory.
77
89
16. Remove overlapping dependencies from your `package.json` and rails/webpacker's `package.json`. For example, don't include `webpack` directly as that's a dependency of rails/webpacker.
90
+
17. Review the new default's changes to `webpacker.yml` and `config/webpack`. Consider each suggested change carefully, especially the change to have your `source_entry_path` be at the top level of your `source_path`.
91
+
18. Make sure that you can run `bin/webpack` without errors before trying your app!
92
+
93
+
## Examples of v5 to v6
94
+
1. [React on Rails Project with HMR and SSR](https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh/compare/webpacker-5.x...master)
95
+
2. [Vue and Sass Example](https://github.com/guillaumebriday/upgrade-webpacker-5-to-6)
0 commit comments