webpacker 5.1.0 → 6.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +8 -8
  3. data/.github/workflows/jest.yml +38 -0
  4. data/.github/workflows/js-lint.yml +39 -0
  5. data/.github/workflows/rubocop.yml +39 -0
  6. data/.github/workflows/ruby.yml +70 -0
  7. data/.gitignore +2 -0
  8. data/.node-version +1 -1
  9. data/.rubocop.yml +11 -16
  10. data/6_0_upgrade.md +43 -0
  11. data/CHANGELOG.md +42 -2
  12. data/CONTRIBUTING.md +1 -1
  13. data/Gemfile.lock +91 -85
  14. data/README.md +226 -113
  15. data/lib/install/config/webpack/base.js +3 -0
  16. data/lib/install/config/webpack/development.js +2 -2
  17. data/lib/install/config/webpack/production.js +2 -2
  18. data/lib/install/config/webpack/test.js +2 -2
  19. data/lib/install/config/webpacker.yml +9 -38
  20. data/lib/install/javascript/packs/application.css +9 -0
  21. data/lib/install/javascript/packs/application.js +3 -1
  22. data/lib/install/template.rb +33 -19
  23. data/lib/tasks/webpacker.rake +2 -11
  24. data/lib/tasks/webpacker/binstubs.rake +6 -4
  25. data/lib/tasks/webpacker/check_binstubs.rake +4 -4
  26. data/lib/tasks/webpacker/check_node.rake +1 -1
  27. data/lib/tasks/webpacker/check_yarn.rake +2 -3
  28. data/lib/tasks/webpacker/compile.rake +4 -2
  29. data/lib/tasks/webpacker/info.rake +12 -10
  30. data/lib/tasks/webpacker/install.rake +6 -4
  31. data/lib/tasks/webpacker/verify_install.rake +2 -1
  32. data/lib/tasks/webpacker/yarn_install.rake +9 -1
  33. data/lib/webpacker/commands.rb +1 -1
  34. data/lib/webpacker/compiler.rb +20 -8
  35. data/lib/webpacker/configuration.rb +7 -23
  36. data/lib/webpacker/dev_server_runner.rb +23 -4
  37. data/lib/webpacker/helper.rb +51 -42
  38. data/lib/webpacker/manifest.rb +1 -1
  39. data/lib/webpacker/runner.rb +1 -0
  40. data/lib/webpacker/version.rb +1 -1
  41. data/lib/webpacker/webpack_runner.rb +7 -2
  42. data/package.json +27 -43
  43. data/package/__tests__/config.js +6 -27
  44. data/package/__tests__/development.js +18 -7
  45. data/package/__tests__/env.js +12 -4
  46. data/package/__tests__/production.js +6 -6
  47. data/package/__tests__/staging.js +7 -6
  48. data/package/__tests__/test.js +4 -5
  49. data/package/babel/preset.js +55 -0
  50. data/package/config.js +4 -9
  51. data/package/configPath.js +3 -0
  52. data/package/env.js +9 -4
  53. data/package/environments/__tests__/base.js +21 -36
  54. data/package/environments/base.js +63 -127
  55. data/package/environments/development.js +46 -39
  56. data/package/environments/production.js +63 -70
  57. data/package/environments/test.js +2 -2
  58. data/package/index.js +13 -8
  59. data/package/rules/babel.js +19 -10
  60. data/package/rules/coffee.js +6 -0
  61. data/package/rules/erb.js +15 -0
  62. data/package/rules/file.js +17 -18
  63. data/package/rules/index.js +16 -18
  64. data/package/rules/less.js +22 -0
  65. data/package/rules/raw.js +5 -0
  66. data/package/rules/sass.js +13 -10
  67. data/package/rules/svg.js +20 -0
  68. data/package/utils/get_style_rule.js +26 -36
  69. data/package/utils/helpers.js +26 -35
  70. data/test/compiler_test.rb +4 -11
  71. data/test/configuration_test.rb +2 -32
  72. data/test/dev_server_runner_test.rb +25 -6
  73. data/test/engine_rake_tasks_test.rb +39 -0
  74. data/test/helper_test.rb +18 -9
  75. data/test/mounted_app/Rakefile +4 -0
  76. data/test/mounted_app/test/dummy/Rakefile +3 -0
  77. data/test/mounted_app/test/dummy/bin/rails +3 -0
  78. data/test/mounted_app/test/dummy/bin/rake +3 -0
  79. data/test/mounted_app/test/dummy/config.ru +5 -0
  80. data/test/mounted_app/test/dummy/config/application.rb +10 -0
  81. data/test/mounted_app/test/dummy/config/environment.rb +3 -0
  82. data/test/mounted_app/test/dummy/config/webpacker.yml +75 -0
  83. data/test/mounted_app/test/dummy/package.json +7 -0
  84. data/test/rake_tasks_test.rb +1 -10
  85. data/test/test_app/config/webpacker.yml +3 -21
  86. data/test/test_app/config/webpacker_public_root.yml +0 -1
  87. data/test/test_app/public/packs/manifest.json +18 -13
  88. data/test/test_app/some.config.js +0 -0
  89. data/test/webpack_runner_test.rb +10 -4
  90. data/webpacker.gemspec +1 -1
  91. data/yarn.lock +2657 -6224
  92. metadata +50 -89
  93. data/.travis.yml +0 -43
  94. data/docs/assets.md +0 -119
  95. data/docs/cloud9.md +0 -310
  96. data/docs/css.md +0 -253
  97. data/docs/deployment.md +0 -130
  98. data/docs/docker.md +0 -68
  99. data/docs/engines.md +0 -213
  100. data/docs/env.md +0 -63
  101. data/docs/es6.md +0 -72
  102. data/docs/folder-structure.md +0 -66
  103. data/docs/integrations.md +0 -220
  104. data/docs/misc.md +0 -23
  105. data/docs/props.md +0 -223
  106. data/docs/testing.md +0 -136
  107. data/docs/troubleshooting.md +0 -156
  108. data/docs/typescript.md +0 -109
  109. data/docs/v4-upgrade.md +0 -142
  110. data/docs/webpack-dev-server.md +0 -92
  111. data/docs/webpack.md +0 -364
  112. data/docs/yarn.md +0 -23
  113. data/lib/install/angular.rb +0 -23
  114. data/lib/install/coffee.rb +0 -25
  115. data/lib/install/config/.browserslistrc +0 -1
  116. data/lib/install/config/babel.config.js +0 -72
  117. data/lib/install/config/postcss.config.js +0 -12
  118. data/lib/install/config/webpack/environment.js +0 -3
  119. data/lib/install/elm.rb +0 -39
  120. data/lib/install/erb.rb +0 -25
  121. data/lib/install/examples/angular/hello_angular.js +0 -7
  122. data/lib/install/examples/angular/hello_angular/app/app.component.ts +0 -9
  123. data/lib/install/examples/angular/hello_angular/app/app.module.ts +0 -16
  124. data/lib/install/examples/angular/hello_angular/index.ts +0 -8
  125. data/lib/install/examples/angular/hello_angular/polyfills.ts +0 -73
  126. data/lib/install/examples/coffee/hello_coffee.coffee +0 -4
  127. data/lib/install/examples/elm/Main.elm +0 -55
  128. data/lib/install/examples/elm/hello_elm.js +0 -16
  129. data/lib/install/examples/erb/hello_erb.js.erb +0 -6
  130. data/lib/install/examples/react/babel.config.js +0 -87
  131. data/lib/install/examples/react/hello_react.jsx +0 -26
  132. data/lib/install/examples/react/tsconfig.json +0 -21
  133. data/lib/install/examples/stimulus/application.js +0 -1
  134. data/lib/install/examples/stimulus/controllers/hello_controller.js +0 -18
  135. data/lib/install/examples/stimulus/controllers/index.js +0 -9
  136. data/lib/install/examples/svelte/app.svelte +0 -11
  137. data/lib/install/examples/svelte/hello_svelte.js +0 -20
  138. data/lib/install/examples/typescript/hello_typescript.ts +0 -4
  139. data/lib/install/examples/typescript/tsconfig.json +0 -24
  140. data/lib/install/examples/vue/app.vue +0 -22
  141. data/lib/install/examples/vue/hello_vue.js +0 -72
  142. data/lib/install/loaders/coffee.js +0 -6
  143. data/lib/install/loaders/elm.js +0 -25
  144. data/lib/install/loaders/erb.js +0 -11
  145. data/lib/install/loaders/svelte.js +0 -9
  146. data/lib/install/loaders/vue.js +0 -6
  147. data/lib/install/react.rb +0 -18
  148. data/lib/install/stimulus.rb +0 -12
  149. data/lib/install/svelte.rb +0 -29
  150. data/lib/install/typescript.rb +0 -42
  151. data/lib/install/vue.rb +0 -49
  152. data/lib/tasks/installers.rake +0 -42
  153. data/package/config_types/__tests__/config_list.js +0 -118
  154. data/package/config_types/__tests__/config_object.js +0 -43
  155. data/package/config_types/config_list.js +0 -75
  156. data/package/config_types/config_object.js +0 -55
  157. data/package/config_types/index.js +0 -7
  158. data/package/rules/module.css.js +0 -3
  159. data/package/rules/module.sass.js +0 -8
  160. data/package/rules/node_modules.js +0 -24
  161. data/package/utils/__tests__/deep_assign.js +0 -32
  162. data/package/utils/__tests__/deep_merge.js +0 -10
  163. data/package/utils/__tests__/get_style_rule.js +0 -65
  164. data/package/utils/__tests__/objectify.js +0 -9
  165. data/package/utils/deep_assign.js +0 -22
  166. data/package/utils/deep_merge.js +0 -22
  167. data/package/utils/objectify.js +0 -3
data/README.md CHANGED
@@ -1,11 +1,15 @@
1
1
  # Webpacker
2
2
 
3
- [![Build Status](https://travis-ci.org/rails/webpacker.svg?branch=master)](https://travis-ci.org/rails/webpacker)
4
- [![node.js](https://img.shields.io/badge/node-%3E%3D%2010.13.0-brightgreen.svg)](https://www.npmjs.com/package/@rails/webpacker)
3
+ [![Ruby specs](https://github.com/rails/webpacker/workflows/Ruby%20specs/badge.svg)](https://github.com/rails/webpacker/actions)
4
+ [![Jest specs](https://github.com/rails/webpacker/workflows/Jest%20specs/badge.svg)](https://github.com/rails/webpacker/actions)
5
+ [![Rubocop](https://github.com/rails/webpacker/workflows/Rubocop/badge.svg)](https://github.com/rails/webpacker/actions)
6
+ [![JS lint](https://github.com/rails/webpacker/workflows/JS%20lint/badge.svg)](https://github.com/rails/webpacker/actions)
7
+
8
+ [![node.js](https://img.shields.io/badge/node-%3E%3D%2010.17.0-brightgreen.svg)](https://www.npmjs.com/package/@rails/webpacker)
5
9
  [![Gem](https://img.shields.io/gem/v/webpacker.svg)](https://rubygems.org/gems/webpacker)
6
10
 
7
11
  Webpacker makes it easy to use the JavaScript pre-processor and bundler
8
- [webpack 4.x.x+](https://webpack.js.org/)
12
+ [webpack 5.x.x+](https://webpack.js.org/)
9
13
  to manage application-like JavaScript in Rails. It coexists with the asset pipeline,
10
14
  as the primary purpose for webpack is app-like JavaScript, not images, CSS, or
11
15
  even JavaScript Sprinkles (that all continues to live in app/assets).
@@ -13,7 +17,7 @@ even JavaScript Sprinkles (that all continues to live in app/assets).
13
17
  However, it is possible to use Webpacker for CSS, images and fonts assets as well,
14
18
  in which case you may not even need the asset pipeline. This is mostly relevant when exclusively using component-based JavaScript frameworks.
15
19
 
16
- **NOTE:** The master branch now hosts the code for v5.x.x. Please refer to [4-x-stable](https://github.com/rails/webpacker/tree/4-x-stable) branch for 4.x documentation.
20
+ **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
21
 
18
22
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
19
23
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
@@ -28,15 +32,6 @@ in which case you may not even need the asset pipeline. This is mostly relevant
28
32
  - [Webpack Configuration](#webpack-configuration)
29
33
  - [Custom Rails environments](#custom-rails-environments)
30
34
  - [Upgrading](#upgrading)
31
- - [Integrations](#integrations)
32
- - [React](./docs/integrations.md#react)
33
- - [Angular with TypeScript](./docs/integrations.md#angular-with-typescript)
34
- - [Vue](./docs/integrations.md#vue)
35
- - [Elm](./docs/integrations.md#elm)
36
- - [Stimulus](./docs/integrations.md#stimulus)
37
- - [Svelte](./docs/integrations.md#svelte)
38
- - [CoffeeScript](./docs/integrations.md#coffeescript)
39
- - [Erb](./docs/integrations.md#erb)
40
35
  - [Paths](#paths)
41
36
  - [Resolved](#resolved)
42
37
  - [Watched](#watched)
@@ -51,23 +46,28 @@ in which case you may not even need the asset pipeline. This is mostly relevant
51
46
 
52
47
  - Ruby 2.4+
53
48
  - Rails 5.2+
54
- - Node.js 10.13.0+
49
+ - Node.js 10.22.1+ || 12+ || 14+
55
50
  - Yarn 1.x+
56
51
 
57
52
  ## Features
58
53
 
59
- - [webpack 4.x.x](https://webpack.js.org/)
54
+ - [webpack 5.x.x](https://webpack.js.org/)
60
55
  - ES6 with [babel](https://babeljs.io/)
61
56
  - Automatic code splitting using multiple entry points
62
- - Stylesheets - Sass and CSS
63
- - Images and fonts
64
- - PostCSS - Auto-Prefixer
65
57
  - Asset compression, source-maps, and minification
66
58
  - CDN support
67
- - React, Angular, Elm and Vue support out-of-the-box
68
59
  - Rails view helpers
69
60
  - Extensible and configurable
70
61
 
62
+ ### Optional support\*
63
+
64
+ _requires extra packages to be installed_
65
+
66
+ - Stylesheets - SASS, LESS and CSS, PostCSS
67
+ - Coffeescript
68
+ - Typescript
69
+ - React
70
+
71
71
  ## Installation
72
72
 
73
73
  You can either add Webpacker during setup of a new Rails 5.1+ application
@@ -82,12 +82,11 @@ Or add it to your `Gemfile`:
82
82
 
83
83
  ```ruby
84
84
  # Gemfile
85
- gem 'webpacker', '~> 5.x'
85
+ gem 'webpacker', '~> 6.x'
86
86
 
87
87
  # OR if you prefer to use master
88
88
  gem 'webpacker', git: 'https://github.com/rails/webpacker.git'
89
89
  yarn add https://github.com/rails/webpacker.git
90
- yarn add core-js regenerator-runtime
91
90
  ```
92
91
 
93
92
  Finally, run the following to install Webpacker:
@@ -121,25 +120,20 @@ app/javascript:
121
120
  ├── packs:
122
121
  │ # only webpack entry files here
123
122
  │ └── application.js
124
- └── src:
125
123
  │ └── application.css
124
+ └── src:
125
+ │ └── my_component.js
126
+ └── stylesheets:
127
+ │ └── my_styles.css
126
128
  └── images:
127
129
  └── logo.svg
128
130
  ```
129
131
 
130
- In `/packs/application.js`, include this at the top of the file:
131
-
132
- ```js
133
- import 'core-js/stable'
134
- import 'regenerator-runtime/runtime'
135
- ```
136
-
137
- You can then link the JavaScript pack in Rails views using the `javascript_pack_tag` helper.
138
- If you have styles imported in your pack file, you can link them by using `stylesheet_pack_tag`:
132
+ You can then link the JavaScript pack in Rails views using the `javascript_packs_with_chunks_tag` helper. If you have styles imported in your pack file, you can link them by using `stylesheet_packs_with_chunks_tag`:
139
133
 
140
134
  ```erb
141
- <%= javascript_pack_tag 'application' %>
142
- <%= stylesheet_pack_tag 'application' %>
135
+ <%= javascript_packs_with_chunks_tag 'application' %>
136
+ <%= stylesheet_packs_with_chunks_tag 'application' %>
143
137
  ```
144
138
 
145
139
  If you want to link a static asset for `<link rel="prefetch">` or `<img />` tag, you
@@ -150,31 +144,6 @@ can use the `asset_pack_path` helper:
150
144
  <img src="<%= asset_pack_path 'images/logo.svg' %>" />
151
145
  ```
152
146
 
153
- If you are using new webpack 4 split chunks API, then consider using `javascript_packs_with_chunks_tag` helper, which creates html
154
- tags for a pack and all the dependent chunks.
155
-
156
- ```erb
157
- <%= javascript_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
158
-
159
- <script src="/packs/vendor-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
160
- <script src="/packs/calendar~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
161
- <script src="/packs/calendar-1016838bab065ae1e314.js" data-turbolinks-track="reload"></script>
162
- <script src="/packs/map~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
163
- <script src="/packs/map-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
164
- ```
165
-
166
- **Important:** Pass all your pack names when using `javascript_packs_with_chunks_tag`
167
- helper otherwise you will get duplicated chunks on the page.
168
-
169
- ```erb
170
- <%# DO %>
171
- <%= javascript_packs_with_chunks_tag 'calendar', 'map' %>
172
-
173
- <%# DON'T %>
174
- <%= javascript_packs_with_chunks_tag 'calendar' %>
175
- <%= javascript_packs_with_chunks_tag 'map' %>
176
- ```
177
-
178
147
  **Note:** In order for your styles or static assets files to be available in your view,
179
148
  you would need to link them in your "pack" or entry file.
180
149
 
@@ -240,7 +209,201 @@ WEBPACKER_DEV_SERVER_HOST=0.0.0.0 ./bin/webpack-dev-server
240
209
 
241
210
  ### Webpack Configuration
242
211
 
243
- See [docs/webpack](docs/webpack.md) for modifying webpack configuration and loaders.
212
+ Webpacker gives you a default set of configuration files for test, development and
213
+ production environments in `config/webpack/*.js`. You can configure each individual
214
+ environment in their respective files or configure them all in the base
215
+ `config/webpack/environment.js` file.
216
+
217
+ By default, you don't need to make any changes to `config/webpack/*.js`
218
+ files since it's all standard production-ready configuration. However,
219
+ if you do need to customize or add a new loader, this is where you would go.
220
+
221
+ Here is how you can modify webpack configuration:
222
+
223
+ You might add separate files to keep your code more organized.
224
+
225
+ ```js
226
+ // config/webpack/custom.js
227
+ module.exports = {
228
+ resolve: {
229
+ alias: {
230
+ jquery: 'jquery/src/jquery',
231
+ vue: 'vue/dist/vue.js',
232
+ React: 'react',
233
+ ReactDOM: 'react-dom',
234
+ vue_resource: 'vue-resource/dist/vue-resource'
235
+ }
236
+ }
237
+ }
238
+ ```
239
+
240
+ Then `require` this file in your `config/webpack/base.js`:
241
+
242
+ ```js
243
+ // config/webpack/base.js
244
+ const { webpackConfig, merge } = require('@rails/webpacker')
245
+ const customConfig = require('./custom')
246
+
247
+ module.exports = merge(webpackConfig, customConfig)
248
+ ```
249
+
250
+ If you need access to configs within Webpacker's configuration,
251
+ you can import them like so:
252
+
253
+ ```js
254
+ // config/webpack/base.js
255
+ const { webpackConfig } = require('@rails/webpacker')
256
+
257
+ console.log(webpackConfig.output_path)
258
+ console.log(webpackConfig.source_path)
259
+ ```
260
+
261
+ ### Integrations
262
+
263
+ Webpacker out of the box supports JS and static assets (fonts, images etc.)
264
+ compilation. To enable support for Coffeescript or Typescript install
265
+ relevant packages,
266
+
267
+ **Coffeescript**
268
+
269
+ ```
270
+ yarn add coffeescript coffee-loader
271
+ ```
272
+
273
+ **Typescript**
274
+
275
+ ```
276
+ yarn add typescript @babel/preset-typescript
277
+ ```
278
+
279
+ Add tsconfig.json
280
+
281
+ ```json
282
+ {
283
+ "compilerOptions": {
284
+ "declaration": false,
285
+ "emitDecoratorMetadata": true,
286
+ "experimentalDecorators": true,
287
+ "lib": ["es6", "dom"],
288
+ "module": "es6",
289
+ "moduleResolution": "node",
290
+ "baseUrl": ".",
291
+ "paths": {
292
+ "*": ["node_modules/*", "app/javascript/*"]
293
+ },
294
+ "sourceMap": true,
295
+ "target": "es5",
296
+ "noEmit": true
297
+ },
298
+ "exclude": ["**/*.spec.ts", "node_modules", "vendor", "public"],
299
+ "compileOnSave": false
300
+ }
301
+ ```
302
+
303
+ #### CSS
304
+
305
+ To enable CSS support in your application, add following packages,
306
+
307
+ ```
308
+ yarn add css-loader mini-css-extract-plugin css-minimizer-webpack-plugin
309
+ ```
310
+
311
+ optionally, add css extension to webpack config for easy resolution
312
+
313
+ ```js
314
+ // config/webpack/base.js
315
+ const { webpackConfig, merge } = require('@rails/webpacker')
316
+ const customConfig = {
317
+ resolve: {
318
+ extensions: ['.css']
319
+ }
320
+ }
321
+
322
+ module.exports = merge(webpackConfig, customConfig)
323
+ ```
324
+
325
+ To enable postcss, sass or less support, add css support first and
326
+ then add the relevant pre-processors:
327
+
328
+ #### Postcss
329
+
330
+ ```
331
+ yarn add postcss-loader
332
+ ```
333
+
334
+ #### Sass
335
+
336
+ ```
337
+ yarn add sass-loader
338
+ ```
339
+
340
+ #### Less
341
+
342
+ ```
343
+ yarn add less-loader
344
+ ```
345
+
346
+ #### React
347
+
348
+ React is supported and you just need to add relevant packages,
349
+
350
+ ```
351
+ yarn add react react-dom @babel/preset-react
352
+ ```
353
+
354
+ if you are using typescript, update your `tsconfig.json`
355
+
356
+ ```json
357
+ {
358
+ "compilerOptions": {
359
+ "declaration": false,
360
+ "emitDecoratorMetadata": true,
361
+ "experimentalDecorators": true,
362
+ "lib": ["es6", "dom"],
363
+ "module": "es6",
364
+ "moduleResolution": "node",
365
+ "sourceMap": true,
366
+ "target": "es5",
367
+ "jsx": "react",
368
+ "noEmit": true
369
+ },
370
+ "exclude": ["**/*.spec.ts", "node_modules", "vendor", "public"],
371
+ "compileOnSave": false
372
+ }
373
+ ```
374
+
375
+ #### Other frameworks
376
+
377
+ Please follow webpack integration guide for relevant framework or library,
378
+
379
+ 1. Svelte - https://github.com/sveltejs/svelte-loader#install
380
+ 2. Angular - https://v2.angular.io/docs/ts/latest/guide/webpack.html#!#configure-webpack
381
+ 3. Vue - https://vue-loader.vuejs.org/guide/
382
+
383
+ For example to add Vue support,
384
+
385
+ ```js
386
+ // config/webpack/rules/vue.js
387
+ const VueLoaderPlugin = require('vue-loader/lib/plugin')
388
+
389
+ module.exports = {
390
+ module: {
391
+ rules: [
392
+ {
393
+ test: /\.vue$/,
394
+ loader: 'vue-loader'
395
+ }
396
+ ]
397
+ },
398
+ plugins: [new VueLoaderPlugin()]
399
+ }
400
+
401
+ // config/webpack/base.js
402
+ const { webpackConfig, merge } = require('@rails/webpacker')
403
+ const vueConfig = require('./rules/vue')
404
+
405
+ module.exports = merge(webpackConfig, vueConfig)
406
+ ```
244
407
 
245
408
  ### Custom Rails environments
246
409
 
@@ -297,7 +460,7 @@ You can run following commands to upgrade Webpacker to the latest stable version
297
460
 
298
461
  ```bash
299
462
  bundle update webpacker
300
- rails webpacker:binstubs
463
+ rails webpacker:install
301
464
  yarn upgrade @rails/webpacker --latest
302
465
  yarn upgrade webpack-dev-server --latest
303
466
 
@@ -305,24 +468,6 @@ yarn upgrade webpack-dev-server --latest
305
468
  yarn add @rails/webpacker@next
306
469
  ```
307
470
 
308
- ## Integrations
309
-
310
- Webpacker ships with basic out-of-the-box integration. You can see a list of available commands/tasks by running `bundle exec rails webpacker`.
311
-
312
- Included install integrations:
313
-
314
- - [React](./docs/integrations.md#React)
315
- - [Angular with TypeScript](./docs/integrations.md#Angular-with-TypeScript)
316
- - [Vue](./docs/integrations.md#Vue)
317
- - [Elm](./docs/integrations.md#Elm)
318
- - [Svelte](./docs/integrations.md#Svelte)
319
- - [Stimulus](./docs/integrations.md#Stimulus)
320
- - [CoffeeScript](./docs/integrations.md#CoffeeScript)
321
- - [Typescript](./docs/integrations.md)
322
- - [Erb](./docs/integrations.md#Erb)
323
-
324
- See [Integrations](./docs/integrations.md) for further details.
325
-
326
471
  ## Paths
327
472
 
328
473
  By default, Webpacker ships with simple conventions for where the JavaScript
@@ -358,16 +503,16 @@ development:
358
503
 
359
504
  If you have `hmr` turned to true, then the `stylesheet_pack_tag` generates no output, as you will want to configure your styles to be inlined in your JavaScript for hot reloading. During production and testing, the `stylesheet_pack_tag` will create the appropriate HTML tags.
360
505
 
361
- ### Resolved
506
+ ### Additional paths
362
507
 
363
508
  If you are adding Webpacker to an existing app that has most of the assets inside
364
509
  `app/assets` or inside an engine, and you want to share that
365
- with webpack modules, you can use the `resolved_paths`
510
+ with webpack modules, you can use the `additional_paths`
366
511
  option available in `config/webpacker.yml`. This lets you
367
512
  add additional paths that webpack should lookup when resolving modules:
368
513
 
369
514
  ```yml
370
- resolved_paths: ['app/assets']
515
+ additional_paths: ['app/assets/**/*', 'vendor/assets/**/*.css', 'Gemfile']
371
516
  ```
372
517
 
373
518
  You can then import these items inside your modules like so:
@@ -382,44 +527,12 @@ import 'images/rails.png'
382
527
  will make the compilation slow, consider adding specific paths instead of
383
528
  whole parent directory if you just need to reference one or two modules
384
529
 
385
- ### Watched
386
-
387
- By default, the lazy compilation is cached until a file is changed under your
388
- tracked paths. You can configure which paths are tracked
389
- by adding new paths to `watched_paths` array. This is much like Rails' `autoload_paths`:
390
-
391
- ```rb
392
- # config/initializers/webpacker.rb
393
- # or config/application.rb
394
- Webpacker::Compiler.watched_paths << 'bower_components'
395
- ```
396
-
397
530
  ## Deployment
398
531
 
399
532
  Webpacker hooks up a new `webpacker:compile` task to `assets:precompile`, which gets run whenever you run `assets:precompile`. If you are not using Sprockets, `webpacker:compile` is automatically aliased to `assets:precompile`. Similar to sprockets both rake tasks will compile packs in production mode but will use `RAILS_ENV` to load configuration from `config/webpacker.yml` (if available).
400
533
 
401
534
  When compiling assets for production on a remote server, such as a continuous integration environment, it's recommended to use `yarn install --frozen-lockfile` to install NPM packages on the remote host to ensure that the installed packages match the `yarn.lock` file.
402
535
 
403
- ## Docs
404
-
405
- - [Development](https://github.com/rails/webpacker#development)
406
- - [Webpack](./docs/webpack.md)
407
- - [Webpack-dev-server](./docs/webpack-dev-server.md)
408
- - [Environment Variables](./docs/env.md)
409
- - [Folder Structure](./docs/folder-structure.md)
410
- - [Assets](./docs/assets.md) - [CSS, Sass and SCSS](./docs/css.md) - [ES6](./docs/es6.md)
411
- - [Props](./docs/props.md)
412
- - [Typescript](./docs/typescript.md)
413
- - [Yarn](./docs/yarn.md)
414
- - [Misc](./docs/misc.md)
415
- - [Deployment](./docs/deployment.md)
416
- - [Docker](./docs/docker.md)
417
- - [Using in Rails engines](./docs/engines.md)
418
- - [Webpacker on Cloud9](./docs/cloud9.md)
419
- - [Testing](./docs/testing.md)
420
- - [Troubleshooting](./docs/troubleshooting.md)
421
- - [v3 to v4 Upgrade Guide](./docs/v4-upgrade.md)
422
-
423
536
  ## Contributing
424
537
 
425
538
  [![Code Helpers](https://www.codetriage.com/rails/webpacker/badges/users.svg)](https://www.codetriage.com/rails/webpacker)