webpacker 5.4.4 → 6.0.0.rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +1 -1
  3. data/.github/workflows/jest.yml +7 -15
  4. data/.github/workflows/js-lint.yml +7 -15
  5. data/.github/workflows/rubocop.yml +1 -1
  6. data/.github/workflows/ruby.yml +18 -16
  7. data/.gitignore +2 -0
  8. data/.node-version +1 -1
  9. data/.rubocop.yml +5 -7
  10. data/CHANGELOG.md +30 -12
  11. data/CONTRIBUTING.md +20 -1
  12. data/Gemfile.lock +83 -83
  13. data/README.md +389 -179
  14. data/config/README.md +3 -0
  15. data/config/webpacker.yml +1 -0
  16. data/docs/deployment.md +9 -11
  17. data/docs/developing_webpacker.md +29 -0
  18. data/docs/troubleshooting.md +61 -25
  19. data/docs/v6_upgrade.md +113 -0
  20. data/gemfiles/Gemfile-rails.6.1.x +12 -0
  21. data/lib/install/{javascript/packs/application.js → application.js} +2 -5
  22. data/lib/install/bin/webpack +4 -7
  23. data/lib/install/bin/yarn +18 -0
  24. data/lib/install/config/webpack/base.js +3 -0
  25. data/lib/install/config/webpack/development.js +2 -2
  26. data/lib/install/config/webpack/production.js +2 -2
  27. data/lib/install/config/webpack/test.js +2 -2
  28. data/lib/install/config/webpacker.yml +21 -49
  29. data/lib/install/package.json +15 -0
  30. data/lib/install/template.rb +64 -29
  31. data/lib/tasks/webpacker/binstubs.rake +6 -4
  32. data/lib/tasks/webpacker/check_binstubs.rake +4 -4
  33. data/lib/tasks/webpacker/check_node.rake +3 -0
  34. data/lib/tasks/webpacker/check_yarn.rake +3 -0
  35. data/lib/tasks/webpacker/clobber.rake +1 -1
  36. data/lib/tasks/webpacker/compile.rake +4 -2
  37. data/lib/tasks/webpacker/info.rake +12 -10
  38. data/lib/tasks/webpacker/install.rake +6 -4
  39. data/lib/tasks/webpacker/verify_config.rake +14 -0
  40. data/lib/tasks/webpacker/verify_install.rake +1 -10
  41. data/lib/tasks/webpacker/yarn_install.rake +9 -7
  42. data/lib/tasks/webpacker.rake +2 -11
  43. data/lib/tasks/yarn.rake +38 -0
  44. data/lib/webpacker/commands.rb +21 -16
  45. data/lib/webpacker/compiler.rb +16 -9
  46. data/lib/webpacker/configuration.rb +8 -32
  47. data/lib/webpacker/dev_server.rb +6 -0
  48. data/lib/webpacker/dev_server_runner.rb +28 -4
  49. data/lib/webpacker/helper.rb +47 -81
  50. data/lib/webpacker/instance.rb +4 -0
  51. data/lib/webpacker/manifest.rb +2 -3
  52. data/lib/webpacker/railtie.rb +8 -2
  53. data/lib/webpacker/runner.rb +1 -1
  54. data/lib/webpacker/version.rb +1 -1
  55. data/lib/webpacker/webpack_runner.rb +29 -3
  56. data/lib/webpacker.rb +1 -1
  57. data/package/__tests__/config.js +5 -37
  58. data/package/__tests__/development.js +13 -21
  59. data/package/__tests__/env.js +16 -4
  60. data/package/__tests__/index.js +9 -0
  61. data/package/__tests__/production.js +6 -6
  62. data/package/__tests__/staging.js +7 -6
  63. data/package/__tests__/test.js +4 -5
  64. data/package/babel/preset.js +54 -0
  65. data/package/config.js +6 -14
  66. data/package/env.js +13 -4
  67. data/package/environments/__tests__/base.js +20 -52
  68. data/package/environments/base.js +68 -128
  69. data/package/environments/development.js +49 -47
  70. data/package/environments/production.js +66 -64
  71. data/package/environments/test.js +2 -2
  72. data/package/index.js +15 -8
  73. data/package/inliningCss.js +7 -0
  74. data/package/rules/babel.js +10 -8
  75. data/package/rules/coffee.js +6 -0
  76. data/package/rules/erb.js +15 -0
  77. data/package/rules/file.js +21 -19
  78. data/package/rules/index.js +16 -18
  79. data/package/rules/less.js +22 -0
  80. data/package/rules/raw.js +5 -0
  81. data/package/rules/sass.js +9 -10
  82. data/package/rules/stylus.js +26 -0
  83. data/package/utils/get_style_rule.js +28 -36
  84. data/package/utils/helpers.js +28 -35
  85. data/package.json +18 -38
  86. data/test/command_test.rb +76 -0
  87. data/test/compiler_test.rb +0 -12
  88. data/test/configuration_test.rb +4 -35
  89. data/test/dev_server_runner_test.rb +36 -6
  90. data/test/engine_rake_tasks_test.rb +39 -0
  91. data/test/helper_test.rb +79 -77
  92. data/test/manifest_test.rb +16 -0
  93. data/test/mounted_app/Rakefile +4 -0
  94. data/test/mounted_app/test/dummy/Rakefile +3 -0
  95. data/test/mounted_app/test/dummy/bin/rails +3 -0
  96. data/test/mounted_app/test/dummy/bin/rake +3 -0
  97. data/test/mounted_app/test/dummy/config/application.rb +10 -0
  98. data/test/mounted_app/test/dummy/config/environment.rb +3 -0
  99. data/test/mounted_app/test/dummy/config/webpacker.yml +75 -0
  100. data/test/mounted_app/test/dummy/config.ru +5 -0
  101. data/test/mounted_app/test/dummy/package.json +7 -0
  102. data/test/rake_tasks_test.rb +1 -10
  103. data/test/test_app/app/{javascript/packs → packs/entrypoints}/application.js +1 -1
  104. data/test/test_app/config/initializers/inspect_autoload_paths.rb +1 -0
  105. data/test/test_app/config/webpacker.yml +5 -31
  106. data/test/test_app/config/webpacker_other_location.yml +79 -0
  107. data/test/test_app/config/webpacker_public_root.yml +0 -1
  108. data/test/test_app/public/packs/manifest.json +36 -18
  109. data/test/test_app/some.config.js +0 -0
  110. data/test/webpack_runner_test.rb +9 -3
  111. data/test/webpacker_test.rb +21 -0
  112. data/webpacker.gemspec +2 -2
  113. data/yarn.lock +1277 -4620
  114. metadata +63 -92
  115. data/docs/assets.md +0 -119
  116. data/docs/cloud9.md +0 -310
  117. data/docs/css.md +0 -308
  118. data/docs/docker.md +0 -68
  119. data/docs/engines.md +0 -213
  120. data/docs/env.md +0 -63
  121. data/docs/es6.md +0 -72
  122. data/docs/folder-structure.md +0 -66
  123. data/docs/integrations.md +0 -220
  124. data/docs/misc.md +0 -23
  125. data/docs/props.md +0 -223
  126. data/docs/target.md +0 -22
  127. data/docs/testing.md +0 -136
  128. data/docs/typescript.md +0 -190
  129. data/docs/v4-upgrade.md +0 -142
  130. data/docs/webpack-dev-server.md +0 -92
  131. data/docs/webpack.md +0 -364
  132. data/docs/yarn.md +0 -23
  133. data/lib/install/angular.rb +0 -23
  134. data/lib/install/coffee.rb +0 -25
  135. data/lib/install/config/.browserslistrc +0 -1
  136. data/lib/install/config/babel.config.js +0 -82
  137. data/lib/install/config/postcss.config.js +0 -12
  138. data/lib/install/config/webpack/environment.js +0 -3
  139. data/lib/install/elm.rb +0 -39
  140. data/lib/install/erb.rb +0 -25
  141. data/lib/install/examples/angular/hello_angular/app/app.component.ts +0 -9
  142. data/lib/install/examples/angular/hello_angular/app/app.module.ts +0 -16
  143. data/lib/install/examples/angular/hello_angular/index.ts +0 -8
  144. data/lib/install/examples/angular/hello_angular/polyfills.ts +0 -73
  145. data/lib/install/examples/angular/hello_angular.js +0 -7
  146. data/lib/install/examples/coffee/hello_coffee.coffee +0 -4
  147. data/lib/install/examples/elm/Main.elm +0 -55
  148. data/lib/install/examples/elm/hello_elm.js +0 -16
  149. data/lib/install/examples/erb/hello_erb.js.erb +0 -6
  150. data/lib/install/examples/react/babel.config.js +0 -99
  151. data/lib/install/examples/react/hello_react.jsx +0 -26
  152. data/lib/install/examples/react/tsconfig.json +0 -21
  153. data/lib/install/examples/stimulus/application.js +0 -1
  154. data/lib/install/examples/stimulus/controllers/hello_controller.js +0 -18
  155. data/lib/install/examples/stimulus/controllers/index.js +0 -9
  156. data/lib/install/examples/svelte/app.svelte +0 -11
  157. data/lib/install/examples/svelte/hello_svelte.js +0 -20
  158. data/lib/install/examples/typescript/hello_typescript.ts +0 -4
  159. data/lib/install/examples/typescript/tsconfig.json +0 -24
  160. data/lib/install/examples/vue/app.vue +0 -22
  161. data/lib/install/examples/vue/hello_vue.js +0 -72
  162. data/lib/install/loaders/coffee.js +0 -6
  163. data/lib/install/loaders/elm.js +0 -25
  164. data/lib/install/loaders/erb.js +0 -11
  165. data/lib/install/loaders/svelte.js +0 -9
  166. data/lib/install/loaders/vue.js +0 -6
  167. data/lib/install/react.rb +0 -18
  168. data/lib/install/stimulus.rb +0 -12
  169. data/lib/install/svelte.rb +0 -29
  170. data/lib/install/typescript.rb +0 -39
  171. data/lib/install/vue.rb +0 -49
  172. data/lib/tasks/installers.rake +0 -42
  173. data/package/config_types/__tests__/config_list.js +0 -118
  174. data/package/config_types/__tests__/config_object.js +0 -43
  175. data/package/config_types/config_list.js +0 -75
  176. data/package/config_types/config_object.js +0 -55
  177. data/package/config_types/index.js +0 -7
  178. data/package/rules/module.css.js +0 -3
  179. data/package/rules/module.sass.js +0 -8
  180. data/package/rules/node_modules.js +0 -22
  181. data/package/utils/__tests__/deep_assign.js +0 -32
  182. data/package/utils/__tests__/deep_merge.js +0 -10
  183. data/package/utils/__tests__/get_style_rule.js +0 -65
  184. data/package/utils/__tests__/objectify.js +0 -9
  185. data/package/utils/deep_assign.js +0 -22
  186. data/package/utils/deep_merge.js +0 -22
  187. data/package/utils/objectify.js +0 -3
  188. /data/test/test_app/app/{javascript/packs → packs/entrypoints}/multi_entry.css +0 -0
  189. /data/test/test_app/app/{javascript/packs → packs/entrypoints}/multi_entry.js +0 -0
data/README.md CHANGED
@@ -5,19 +5,15 @@
5
5
  [![Rubocop](https://github.com/rails/webpacker/workflows/Rubocop/badge.svg)](https://github.com/rails/webpacker/actions)
6
6
  [![JS lint](https://github.com/rails/webpacker/workflows/JS%20lint/badge.svg)](https://github.com/rails/webpacker/actions)
7
7
 
8
- [![node.js](https://img.shields.io/badge/node-%3E%3D%2010.17.0-brightgreen.svg)](https://www.npmjs.com/package/@rails/webpacker)
8
+ [![node.js](https://img.shields.io/badge/node-%3E%3D%2012.0.0-brightgreen.svg)](https://www.npmjs.com/package/@rails/webpacker)
9
9
  [![Gem](https://img.shields.io/gem/v/webpacker.svg)](https://rubygems.org/gems/webpacker)
10
10
 
11
11
  Webpacker makes it easy to use the JavaScript pre-processor and bundler
12
- [webpack 4.x.x+](https://webpack.js.org/)
13
- to manage application-like JavaScript in Rails. It coexists with the asset pipeline,
14
- as the primary purpose for webpack is app-like JavaScript, not images, CSS, or
15
- even JavaScript Sprinkles (that all continues to live in app/assets).
12
+ [Webpack v5](https://webpack.js.org/)
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, fonts, and CSS.
16
15
 
17
- However, it is possible to use Webpacker for CSS, images and fonts assets as well,
18
- in which case you may not even need the asset pipeline. This is mostly relevant when exclusively using component-based JavaScript frameworks.
19
-
20
- **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.
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.
21
17
 
22
18
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
23
19
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
@@ -26,27 +22,29 @@ in which case you may not even need the asset pipeline. This is mostly relevant
26
22
 
27
23
  - [Prerequisites](#prerequisites)
28
24
  - [Features](#features)
25
+ - [Optional support](#optional-support)
29
26
  - [Installation](#installation)
30
27
  - [Usage](#usage)
28
+ - [Server-Side Rendering (SSR)](#server-side-rendering-ssr)
31
29
  - [Development](#development)
32
30
  - [Webpack Configuration](#webpack-configuration)
31
+ - [Babel Configuration](#babel-configuration)
32
+ - [Integrations](#integrations)
33
+ - [React](#react)
34
+ - [CoffeeScript](#coffeescript)
35
+ - [TypeScript](#typescript)
36
+ - [CSS](#css)
37
+ - [Postcss](#postcss)
38
+ - [Sass](#sass)
39
+ - [Less](#less)
40
+ - [Stylus](#stylus)
41
+ - [Other frameworks](#other-frameworks)
33
42
  - [Custom Rails environments](#custom-rails-environments)
34
43
  - [Upgrading](#upgrading)
35
- - [Integrations](#integrations)
36
- - [React](./docs/integrations.md#react)
37
- - [Angular with TypeScript](./docs/integrations.md#angular-with-typescript)
38
- - [Vue](./docs/integrations.md#vue)
39
- - [Elm](./docs/integrations.md#elm)
40
- - [Stimulus](./docs/integrations.md#stimulus)
41
- - [Svelte](./docs/integrations.md#svelte)
42
- - [Typescript](./docs/typescript.md)
43
- - [CoffeeScript](./docs/integrations.md#coffeescript)
44
- - [Erb](./docs/integrations.md#erb)
45
44
  - [Paths](#paths)
46
- - [Resolved](#resolved)
47
- - [Watched](#watched)
45
+ - [Additional paths](#additional-paths)
48
46
  - [Deployment](#deployment)
49
- - [Docs](#docs)
47
+ - [Troubleshooting](#troubleshooting)
50
48
  - [Contributing](#contributing)
51
49
  - [License](#license)
52
50
 
@@ -56,59 +54,52 @@ in which case you may not even need the asset pipeline. This is mostly relevant
56
54
 
57
55
  - Ruby 2.4+
58
56
  - Rails 5.2+
59
- - Node.js 10.17.0+
60
- - Yarn 1.x+
57
+ - Node.js 12.13.0+ || 14+
58
+ - Yarn
61
59
 
62
60
  ## Features
63
61
 
64
- - [webpack 4.x.x](https://webpack.js.org/)
62
+ - [Webpack v5](https://webpack.js.org/)
65
63
  - ES6 with [babel](https://babeljs.io/)
66
64
  - Automatic code splitting using multiple entry points
67
- - Stylesheets - Sass and CSS
68
- - Images and fonts
69
- - PostCSS - Auto-Prefixer
70
65
  - Asset compression, source-maps, and minification
71
66
  - CDN support
72
- - React, Angular, Elm and Vue support out-of-the-box
73
67
  - Rails view helpers
74
68
  - Extensible and configurable
75
69
 
70
+ ### Optional support
71
+
72
+ _requires extra packages to be installed_
73
+
74
+ - Stylesheets - Sass, Less, Stylus and Css, PostCSS
75
+ - CoffeeScript
76
+ - TypeScript
77
+ - React
78
+
76
79
  ## Installation
77
80
 
78
- You can either add Webpacker during setup of a new Rails 5.1+ application
79
- using new `--webpack` option:
81
+ You can configure a new Rails application with Webpacker right from the start using the `-j webpack` option:
80
82
 
81
83
  ```bash
82
- # Available Rails 5.1+
83
- rails new myapp --webpack
84
+ rails new myapp -j webpack
84
85
  ```
85
86
 
86
- Or add it to your `Gemfile`:
87
+ Or you can add it later by changing your `Gemfile`:
87
88
 
88
89
  ```ruby
89
90
  # Gemfile
90
- gem 'webpacker', '~> 5.x'
91
+ gem 'webpacker', '~> 6.0'
91
92
 
92
93
  # OR if you prefer to use master
93
94
  gem 'webpacker', git: 'https://github.com/rails/webpacker.git'
94
95
  yarn add https://github.com/rails/webpacker.git
95
- yarn add core-js regenerator-runtime
96
- ```
97
-
98
- Finally, run the following to install Webpacker:
99
-
100
- ```bash
101
- bundle
102
- bundle exec rails webpacker:install
103
-
104
- # OR (on rails version < 5.0)
105
- bundle exec rake webpacker:install
106
96
  ```
107
97
 
108
- Optional: To fix ["unmet peer dependency" warnings](https://github.com/rails/webpacker/issues/1078),
98
+ Then running the following to install Webpacker:
109
99
 
110
100
  ```bash
111
- yarn upgrade
101
+ ./bin/bundle install
102
+ ./bin/rails webpacker:install
112
103
  ```
113
104
 
114
105
  When `package.json` and/or `yarn.lock` changes, such as when pulling down changes to your local environment in a team settings, be sure to keep your NPM packages up-to-date:
@@ -123,10 +114,9 @@ Once installed, you can start writing modern ES6-flavored JavaScript apps right
123
114
 
124
115
  ```yml
125
116
  app/javascript:
126
- ├── packs:
127
- │ # only webpack entry files here
128
- └── application.js
129
- │ └── application.css
117
+ # Only Webpack entry files here
118
+ └── application.js
119
+ └── application.css
130
120
  └── src:
131
121
  │ └── my_component.js
132
122
  └── stylesheets:
@@ -135,102 +125,116 @@ app/javascript:
135
125
  └── logo.svg
136
126
  ```
137
127
 
138
- In `/packs/application.js`, include this at the top of the file:
139
-
140
- ```js
141
- import 'core-js/stable'
142
- import 'regenerator-runtime/runtime'
143
- ```
144
-
145
- You can then link the JavaScript pack in Rails views using the `javascript_pack_tag` helper.
146
- If you have styles imported in your pack file, you can link them by using `stylesheet_pack_tag`:
128
+ You can then link the JavaScript pack in Rails views using the `javascript_pack_tag` helper. If you have styles imported in your pack file, you can link them by using `stylesheet_pack_tag`:
147
129
 
148
130
  ```erb
149
131
  <%= javascript_pack_tag 'application' %>
150
132
  <%= stylesheet_pack_tag 'application' %>
151
133
  ```
152
134
 
153
- If you want to link a static asset for `<link rel="prefetch">` or `<img />` tag, you
154
- can use the `asset_pack_path` helper:
135
+ The `javascript_pack_tag` and `stylesheet_pack_tag` helpers will include all the transpiled
136
+ packs with the chunks in your view, which creates html tags for all the chunks.
137
+
138
+ The result looks like this:
155
139
 
156
140
  ```erb
157
- <link rel="prefetch" href="<%= asset_pack_path 'application.css' %>" />
158
- <img src="<%= asset_pack_path 'images/logo.svg' %>" />
141
+ <%= javascript_pack_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
142
+
143
+ <script src="/packs/vendor-16838bab065ae1e314.js" data-turbolinks-track="reload" defer></script>
144
+ <script src="/packs/calendar~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload" defer></script>
145
+ <script src="/packs/calendar-1016838bab065ae1e314.js" data-turbolinks-track="reload" defer"></script>
146
+ <script src="/packs/map~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload" defer></script>
147
+ <script src="/packs/map-16838bab065ae1e314.js" data-turbolinks-track="reload" defer></script>
159
148
  ```
160
149
 
161
- If you are using new webpack 4 split chunks API, then consider using `javascript_packs_with_chunks_tag` helper, which creates html
162
- tags for a pack and all the dependent chunks.
150
+ **Important:** Pass all your pack names as multiple arguments, not multiple calls, when using `javascript_pack_tag` and the **`stylesheet_pack_tag`. Otherwise, you will get duplicated chunks on the page. Be especially careful if you might be calling these view helpers from your view, partials, and the layout for a page. You will need some logic to ensure you call the helpers only once with multiple arguments.
151
+
152
+ ```erb
153
+ <%# DO %>
154
+ <%= javascript_pack_tag 'calendar', 'map' %>
155
+ <%= stylesheet_pack_tag 'calendar', 'map' %>
156
+
157
+ <%# DON'T %>
158
+ <%= javascript_pack_tag 'calendar' %>
159
+ <%= javascript_pack_tag 'map' %>
160
+ <%= stylesheet_pack_tag 'calendar' %>
161
+ <%= stylesheet_pack_tag 'map' %>
162
+ ```
163
163
 
164
+ If you want to link a static asset for `<img />` tag, you can use the `asset_pack_path` helper:
164
165
  ```erb
165
- <%= javascript_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
166
+ <img src="<%= asset_pack_path 'images/logo.svg' %>" />
167
+ ```
166
168
 
167
- <script src="/packs/vendor-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
168
- <script src="/packs/calendar~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
169
- <script src="/packs/calendar-1016838bab065ae1e314.js" data-turbolinks-track="reload"></script>
170
- <script src="/packs/map~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
171
- <script src="/packs/map-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
169
+ Or use the dedicated helper:
170
+ ```erb
171
+ <%= image_pack_tag 'application.png', size: '16x10', alt: 'Edit Entry' %>
172
+ <%= image_pack_tag 'picture.png', srcset: { 'picture-2x.png' => '2x' } %>
172
173
  ```
173
174
 
174
- **Important:** Pass all your pack names when using `javascript_packs_with_chunks_tag`
175
- helper otherwise you will get duplicated chunks on the page.
175
+ If you want to create a favicon:
176
+ ```erb
177
+ <%= favicon_pack_tag 'mb-icon.png', rel: 'apple-touch-icon', type: 'image/png' %>
178
+ ```
176
179
 
180
+ If you want to preload a static asset in your `<head>`, you can use the `preload_pack_asset` helper:
177
181
  ```erb
178
- <%# DO %>
179
- <%= javascript_packs_with_chunks_tag 'calendar', 'map' %>
182
+ <%= preload_pack_asset 'fonts/fa-regular-400.woff2' %>
183
+ ```
180
184
 
181
- <%# DON'T %>
182
- <%= javascript_packs_with_chunks_tag 'calendar' %>
183
- <%= javascript_packs_with_chunks_tag 'map' %>
185
+ If you want to use images in your stylesheets:
186
+
187
+ ```css
188
+ .foo {
189
+ background-image: url('../images/logo.svg')
190
+ }
184
191
  ```
192
+ ##### Defer for `javascript_pack_tag`
193
+ Note, the default of "defer" for the `javascript_pack_tag`. You can override that to `false`. 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`.
194
+
195
+ #### Server-Side Rendering (SSR)
185
196
 
186
- **Note:** In order for your styles or static assets files to be available in your view,
187
- you would need to link them in your "pack" or entry file.
197
+ Note, if you are using server-side rendering of JavaScript with dynamic code-splitting, as is often done with extensions to Webpacker, like [React on Rails](https://github.com/shakacode/react_on_rails), your JavaScript should create the link prefetch HTML tags that you will use, so you won't need to use to `asset_pack_path` in those circumstances.
198
+
199
+ **Note:** In order for your styles or static assets files to be available in your view, you would need to link them in your "pack" or entry file. Otherwise, Webpack won't know to package up those files.
188
200
 
189
201
  ### Development
190
202
 
191
- Webpacker ships with two binstubs: `./bin/webpack` and `./bin/webpack-dev-server`.
192
- Both are thin wrappers around the standard `webpack.js` and `webpack-dev-server.js`
193
- executables to ensure that the right configuration files and environmental variables
194
- are loaded based on your environment.
203
+ Webpacker ships with two binstubs: `./bin/webpack` and `./bin/webpack-dev-server`. Both are thin wrappers around the standard `webpack.js` and `webpack-dev-server.js` executables to ensure that the right configuration files and environmental variables are loaded based on your environment.
195
204
 
196
- In development, Webpacker compiles on demand rather than upfront by default. This
197
- happens when you refer to any of the pack assets using the Webpacker helper methods.
198
- This means that you don't have to run any separate processes. Compilation errors are logged
199
- to the standard Rails log.
205
+ In development, Webpacker compiles on demand rather than upfront by default. This happens when you refer to any of the pack assets using the Webpacker helper methods. This means that you don't have to run any separate processes. Compilation errors are logged to the standard Rails log. However, this auto-compilation happens when a web request is made that requires an updated webpack build, not when files change. Thus, that can be painfully slow for front-end development in this default way. Instead, you should either run the `bin/webpack --watch` or run `./bin/webpack-dev-server`
200
206
 
201
- 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`. Windows users will need to run these commands
202
- in a terminal separate from `bundle exec rails s`. This process will watch for changes
203
- in the `app/javascript/packs/*.js` files and automatically reload the browser to match.
207
+ 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`. Windows users will need to run these commands in a terminal separate from `bundle exec rails s`. This process will watch for changes in the relevant files, defined by `webpacker.yml` configuration settings for `source_path`, `source_entry_path`, and `additional_paths`, and it will then automatically reload the browser to match. This feature is also known as [Hot Module Replacement](https://webpack.js.org/concepts/hot-module-replacement/).
204
208
 
205
209
  ```bash
206
210
  # webpack dev server
207
211
  ./bin/webpack-dev-server
208
212
 
209
213
  # watcher
210
- ./bin/webpack --watch --colors --progress
214
+ ./bin/webpack --watch --progress
211
215
 
212
216
  # standalone build
213
- ./bin/webpack
217
+ ./bin/webpack --progress
218
+
219
+ # Help
220
+ ./bin/webpack help
221
+
222
+ # Version
223
+ ./bin/webpack version
224
+
225
+ # Info
226
+ ./bin/webpack info
214
227
  ```
215
228
 
216
- Once you start this development server, Webpacker will automatically start proxying all
217
- webpack asset requests to this server. When you stop the server, it'll revert back to
218
- on-demand compilation.
229
+ Once you start this webpack development server, Webpacker will automatically start proxying all webpack asset requests to this server. When you stop this server, Rails will detect that it's not running and Rails will revert back to on-demand compilation _if_ you have the `compile` option set to true in your `config/webpacker.yml`
219
230
 
220
- You can use environment variables as options supported by
221
- [webpack-dev-server](https://webpack.js.org/configuration/dev-server/) in the
222
- form `WEBPACKER_DEV_SERVER_<OPTION>`. Please note that these environmental
223
- variables will always take precedence over the ones already set in the
224
- configuration file, and that the _same_ environmental variables must
225
- be available to the `rails server` process.
231
+ You can use environment variables as options supported by [webpack-dev-server](https://webpack.js.org/configuration/dev-server/) in the form `WEBPACKER_DEV_SERVER_<OPTION>`. Please note that these environmental variables will always take precedence over the ones already set in the configuration file, and that the _same_ environmental variables must be available to the `rails server` process.
226
232
 
227
233
  ```bash
228
234
  WEBPACKER_DEV_SERVER_HOST=example.com WEBPACKER_DEV_SERVER_INLINE=true WEBPACKER_DEV_SERVER_HOT=false ./bin/webpack-dev-server
229
235
  ```
230
236
 
231
- By default, the webpack dev server listens on `localhost` in development for security purposes.
232
- However, if you want your app to be available over local LAN IP or a VM instance like vagrant,
233
- you can set the `host` when running `./bin/webpack-dev-server` binstub:
237
+ By default, the webpack dev server listens on `localhost` in development for security purposes. However, if you want your app to be available over local LAN IP or a VM instance like vagrant, you can set the `host` when running `./bin/webpack-dev-server` binstub:
234
238
 
235
239
  ```bash
236
240
  WEBPACKER_DEV_SERVER_HOST=0.0.0.0 ./bin/webpack-dev-server
@@ -239,16 +243,254 @@ WEBPACKER_DEV_SERVER_HOST=0.0.0.0 ./bin/webpack-dev-server
239
243
  **Note:** You need to allow webpack-dev-server host as an allowed origin for `connect-src` if you are running your application in a restrict CSP environment (like Rails 5.2+). This can be done in Rails 5.2+ in the CSP initializer `config/initializers/content_security_policy.rb` with a snippet like this:
240
244
 
241
245
  ```ruby
242
- Rails.application.config.content_security_policy do |policy|
243
- policy.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' if Rails.env.development?
244
- end
246
+ Rails.application.config.content_security_policy do |policy|
247
+ policy.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' if Rails.env.development?
248
+ end
245
249
  ```
246
250
 
247
251
  **Note:** Don't forget to prefix `ruby` when running these binstubs on Windows
248
252
 
253
+
249
254
  ### Webpack Configuration
250
255
 
251
- See [docs/webpack](docs/webpack.md) for modifying webpack configuration and loaders.
256
+ Webpacker gives you a default set of configuration files for test, development and production environments in `config/webpack/*.js`. You can configure each individual environment in their respective files or configure them all in the base
257
+ `config/webpack/base.js` file.
258
+
259
+ By default, you don't need to make any changes to `config/webpack/*.js` files since it's all standard production-ready configuration. However, if you do need to customize or add a new loader, this is where you would go.
260
+
261
+ Here is how you can modify webpack configuration:
262
+
263
+ You might add separate files to keep your code more organized.
264
+
265
+ ```js
266
+ // config/webpack/custom.js
267
+ module.exports = {
268
+ resolve: {
269
+ alias: {
270
+ jquery: 'jquery/src/jquery',
271
+ vue: 'vue/dist/vue.js',
272
+ React: 'react',
273
+ ReactDOM: 'react-dom',
274
+ vue_resource: 'vue-resource/dist/vue-resource'
275
+ }
276
+ }
277
+ }
278
+ ```
279
+
280
+ Then `require` this file in your `config/webpack/base.js`:
281
+
282
+ ```js
283
+ // config/webpack/base.js
284
+ const { webpackConfig, merge } = require('@rails/webpacker')
285
+ const customConfig = require('./custom')
286
+
287
+ module.exports = merge(webpackConfig, customConfig)
288
+ ```
289
+
290
+ If you need access to configs within Webpacker's configuration, you can import them like so:
291
+
292
+ ```js
293
+ // config/webpack/base.js
294
+ const { webpackConfig } = require('@rails/webpacker')
295
+
296
+ console.log(webpackConfig.output_path)
297
+ console.log(webpackConfig.source_path)
298
+
299
+ // Or to print out your whole webpack configuration
300
+ console.log(JSON.stringify(webpackConfig, undefined, 2))
301
+ ```
302
+
303
+ ### Babel configuration
304
+
305
+ By default, you will find the Webpacker preset in your `package.json`.
306
+
307
+ ```json
308
+ "babel": {
309
+ "presets": [
310
+ "./node_modules/@rails/webpacker/package/babel/preset.js"
311
+ ]
312
+ },
313
+ ```
314
+
315
+ Optionally, you can change your Babel configuration by removing these lines in your `package.json` and add [a Babel configuration file](https://babeljs.io/docs/en/config-files) in your project.
316
+
317
+
318
+ ### Integrations
319
+
320
+ Webpacker out of the box supports JS and static assets (fonts, images etc.) compilation. To enable support for CoffeeScript or TypeScript install relevant packages:
321
+
322
+ #### React
323
+
324
+ ```bash
325
+ yarn add react react-dom @babel/preset-react
326
+ ```
327
+
328
+ ...if you are using typescript, update your `tsconfig.json`
329
+
330
+ ```json
331
+ {
332
+ "compilerOptions": {
333
+ "declaration": false,
334
+ "emitDecoratorMetadata": true,
335
+ "experimentalDecorators": true,
336
+ "lib": ["es6", "dom"],
337
+ "module": "es6",
338
+ "moduleResolution": "node",
339
+ "sourceMap": true,
340
+ "target": "es5",
341
+ "jsx": "react",
342
+ "noEmit": true
343
+ },
344
+ "exclude": ["**/*.spec.ts", "node_modules", "vendor", "public"],
345
+ "compileOnSave": false
346
+ }
347
+ ```
348
+
349
+ #### CoffeeScript
350
+
351
+ ```bash
352
+ yarn add coffeescript coffee-loader
353
+ ```
354
+
355
+ #### TypeScript
356
+
357
+ ```bash
358
+ yarn add typescript @babel/preset-typescript
359
+ ```
360
+
361
+ Babel won’t perform any type-checking on TypeScript code. To optionally use type-checking run:
362
+
363
+ ```bash
364
+ yarn add fork-ts-checker-webpack-plugin
365
+ ```
366
+
367
+ Add tsconfig.json
368
+
369
+ ```json
370
+ {
371
+ "compilerOptions": {
372
+ "declaration": false,
373
+ "emitDecoratorMetadata": true,
374
+ "experimentalDecorators": true,
375
+ "lib": ["es6", "dom"],
376
+ "module": "es6",
377
+ "moduleResolution": "node",
378
+ "baseUrl": ".",
379
+ "paths": {
380
+ "*": ["node_modules/*", "app/packs/*"]
381
+ },
382
+ "sourceMap": true,
383
+ "target": "es5",
384
+ "noEmit": true
385
+ },
386
+ "exclude": ["**/*.spec.ts", "node_modules", "vendor", "public"],
387
+ "compileOnSave": false
388
+ }
389
+ ```
390
+
391
+ Then modify the webpack config to use it as a plugin:
392
+
393
+ ```js
394
+ // config/webpack/base.js
395
+ const { webpackConfig, merge } = require("@rails/webpacker");
396
+ const ForkTSCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
397
+
398
+ module.exports = merge(webpackConfig, {
399
+ plugins: [new ForkTSCheckerWebpackPlugin()],
400
+ });
401
+ ```
402
+
403
+ #### CSS
404
+
405
+ To enable CSS support in your application, add following packages:
406
+
407
+ ```bash
408
+ yarn add css-loader style-loader mini-css-extract-plugin css-minimizer-webpack-plugin
409
+ ```
410
+
411
+ Optionally, add the `CSS` extension to webpack config for easy resolution.
412
+
413
+ ```js
414
+ // config/webpack/base.js
415
+ const { webpackConfig, merge } = require('@rails/webpacker')
416
+ const customConfig = {
417
+ resolve: {
418
+ extensions: ['.css']
419
+ }
420
+ }
421
+
422
+ module.exports = merge(webpackConfig, customConfig)
423
+ ```
424
+
425
+ To enable `PostCSS`, `Sass` or `Less` support, add `CSS` support first and
426
+ then add the relevant pre-processors:
427
+
428
+ #### Postcss
429
+
430
+ ```bash
431
+ yarn add postcss postcss-loader
432
+ ```
433
+
434
+ Optionally add these two plugins if they are required in your `postcss.config.js`:
435
+ ```bash
436
+ yarn add postcss-preset-env postcss-flexbugs-fixes
437
+ ```
438
+
439
+ #### Sass
440
+
441
+ ```bash
442
+ yarn add sass sass-loader
443
+ ```
444
+
445
+ #### Less
446
+
447
+ ```bash
448
+ yarn add less less-loader
449
+ ```
450
+
451
+ #### Stylus
452
+
453
+ ```bash
454
+ yarn add stylus stylus-loader
455
+ ```
456
+
457
+ #### Other frameworks
458
+
459
+ Please follow webpack integration guide for relevant framework or library,
460
+
461
+ 1. [Svelte](https://github.com/sveltejs/svelte-loader#install)
462
+ 2. [Angular](https://v2.angular.io/docs/ts/latest/guide/webpack.html#!#configure-webpack)
463
+ 3. [Vue](https://vue-loader.vuejs.org/guide/)
464
+
465
+ For example to add Vue support:
466
+ ```js
467
+ // config/webpack/rules/vue.js
468
+ const { VueLoaderPlugin } = require('vue-loader')
469
+
470
+ module.exports = {
471
+ module: {
472
+ rules: [
473
+ {
474
+ test: /\.vue$/,
475
+ loader: 'vue-loader'
476
+ }
477
+ ]
478
+ },
479
+ plugins: [new VueLoaderPlugin()],
480
+ resolve: {
481
+ extensions: ['.vue']
482
+ }
483
+ }
484
+ ```
485
+
486
+ ```js
487
+ // config/webpack/base.js
488
+ const { webpackConfig, merge } = require('@rails/webpacker')
489
+ const vueConfig = require('./rules/vue')
490
+
491
+ module.exports = merge(vueConfig, webpackConfig)
492
+ ```
493
+
252
494
 
253
495
  ### Custom Rails environments
254
496
 
@@ -270,8 +512,7 @@ staging:
270
512
  public_output_path: packs-staging
271
513
  ```
272
514
 
273
- or, Webpacker will use production environment as a fallback environment for loading configurations. Please note, `NODE_ENV` can either be set to `production`, `development` or `test`.
274
- This means you don't need to create additional environment files inside `config/webpacker/*` and instead use webpacker.yml to load different configurations using `RAILS_ENV`.
515
+ Otherwise Webpacker will use production environment as a fallback environment for loading configurations. Please note, `NODE_ENV` can either be set to `production`, `development` or `test`. This means you don't need to create additional environment files inside `config/webpacker/*` and instead use webpacker.yml to load different configurations using `RAILS_ENV`.
275
516
 
276
517
  For example, the below command will compile assets in production mode but will use staging configurations from `config/webpacker.yml` if available or use fallback production environment configuration:
277
518
 
@@ -279,22 +520,20 @@ For example, the below command will compile assets in production mode but will u
279
520
  RAILS_ENV=staging bundle exec rails assets:precompile
280
521
  ```
281
522
 
282
- And, this will compile in development mode and load configuration for cucumber environment
283
- if defined in webpacker.yml or fallback to production configuration
523
+ And, this will compile in development mode and load configuration for cucumber environment if defined in webpacker.yml or fallback to production configuration
284
524
 
285
525
  ```bash
286
526
  RAILS_ENV=cucumber NODE_ENV=development bundle exec rails assets:precompile
287
527
  ```
288
528
 
289
- Please note, binstubs compiles in development mode however rake tasks
290
- compiles in production mode.
529
+ Please note, binstubs compiles in development mode however rake tasks compiles in production mode.
291
530
 
292
531
  ```bash
293
- # Compiles in development mode unless NODE_ENV is specified
532
+ # Compiles in development mode unless NODE_ENV is specified, per the binstub source
294
533
  ./bin/webpack
295
534
  ./bin/webpack-dev-server
296
535
 
297
- # compiles in production mode by default unless NODE_ENV is specified
536
+ # Compiles in production mode by default unless NODE_ENV is specified, per `lib/tasks/webpacker/compile.rake`
298
537
  bundle exec rails assets:precompile
299
538
  bundle exec rails webpacker:compile
300
539
  ```
@@ -304,53 +543,37 @@ bundle exec rails webpacker:compile
304
543
  You can run following commands to upgrade Webpacker to the latest stable version. This process involves upgrading the gem and related JavaScript packages:
305
544
 
306
545
  ```bash
546
+ # check your Gemfile for version restrictions
307
547
  bundle update webpacker
308
- rails webpacker:binstubs
548
+
549
+ # overwrite your changes to the default install files and revert any unwanted changes from the install
550
+ rails webpacker:install
551
+
552
+ # yarn 1 instructions
309
553
  yarn upgrade @rails/webpacker --latest
310
554
  yarn upgrade webpack-dev-server --latest
311
555
 
556
+ # yarn 2 instructions
557
+ yarn up @rails/webpacker@latest
558
+ yarn up webpack-dev-server@latest
559
+
312
560
  # Or to install the latest release (including pre-releases)
313
561
  yarn add @rails/webpacker@next
314
562
  ```
315
563
 
316
- ## Integrations
317
-
318
- Webpacker ships with basic out-of-the-box integration. You can see a list of available commands/tasks by running `bundle exec rails webpacker`.
319
-
320
- Included install integrations:
321
-
322
- - [React](./docs/integrations.md#React)
323
- - [Angular with TypeScript](./docs/integrations.md#Angular-with-TypeScript)
324
- - [Vue](./docs/integrations.md#Vue)
325
- - [Elm](./docs/integrations.md#Elm)
326
- - [Svelte](./docs/integrations.md#Svelte)
327
- - [Stimulus](./docs/integrations.md#Stimulus)
328
- - [CoffeeScript](./docs/integrations.md#CoffeeScript)
329
- - [Typescript](./docs/typescript.md)
330
- - [Erb](./docs/integrations.md#Erb)
331
-
332
- See [Integrations](./docs/integrations.md) for further details.
564
+ Also, consult the [CHANGELOG](./CHANGELOG.md) for additional upgrade links.
333
565
 
334
566
  ## Paths
335
567
 
336
- By default, Webpacker ships with simple conventions for where the JavaScript
337
- app files and compiled webpack bundles will go in your Rails app.
338
- All these options are configurable from `config/webpacker.yml` file.
568
+ By default, Webpacker ships with simple conventions for where the JavaScript app files and compiled webpack bundles will go in your Rails app. All these options are configurable from `config/webpacker.yml` file.
339
569
 
340
- The configuration for what webpack is supposed to compile by default rests
341
- on the convention that every file in `app/javascript/packs/*`**(default)**
342
- or whatever path you set for `source_entry_path` in the `webpacker.yml` configuration
343
- is turned into their own output files (or entry points, as webpack calls it). Therefore you don't want to put anything inside `packs` directory that you do not want to be
344
- an entry file. As a rule of thumb, put all files you want to link in your views inside
345
- "packs" directory and keep everything else under `app/javascript`.
570
+ The configuration for what webpack is supposed to compile by default rests on the convention that every file in `app/packs/entrypoints/*`**(default)** or whatever path you set for `source_entry_path` in the `webpacker.yml` configuration is turned into their own output files (or entry points, as webpack calls it). Therefore you don't want to put anything inside `packs` directory that you do not want to be an entry file. As a rule of thumb, put all files you want to link in your views inside "packs" directory and keep everything else under `app/packs`.
346
571
 
347
- Suppose you want to change the source directory from `app/javascript`
348
- to `frontend` and output to `assets/packs`. This is how you would do it:
572
+ Suppose you want to change the source directory from `app/packs` to `frontend` and output to `assets/packs`. This is how you would do it:
349
573
 
350
574
  ```yml
351
575
  # config/webpacker.yml
352
- source_path: frontend
353
- source_entry_path: packs
576
+ source_path: frontend # packs are in frontend/packs
354
577
  public_output_path: assets/packs # outputs to => public/assets/packs
355
578
  ```
356
579
 
@@ -366,16 +589,13 @@ development:
366
589
 
367
590
  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.
368
591
 
369
- ### Resolved
592
+ ### Additional paths
370
593
 
371
- If you are adding Webpacker to an existing app that has most of the assets inside
372
- `app/assets` or inside an engine, and you want to share that
373
- with webpack modules, you can use the `additional_paths`
374
- option available in `config/webpacker.yml`. This lets you
375
- add additional paths that webpack should lookup when resolving modules:
594
+ If you are adding Webpacker to an existing app that has most of the assets inside `app/assets` or inside an engine, and you want to share that with webpack modules, you can use the `additional_paths` option available in `config/webpacker.yml`. This lets you
595
+ add additional paths that webpack should look up when resolving modules:
376
596
 
377
597
  ```yml
378
- additional_paths: ['app/assets']
598
+ additional_paths: ['app/assets', 'vendor/assets']
379
599
  ```
380
600
 
381
601
  You can then import these items inside your modules like so:
@@ -386,9 +606,10 @@ import 'stylesheets/main'
386
606
  import 'images/rails.png'
387
607
  ```
388
608
 
389
- **Note:** Please be careful when adding paths here otherwise it
390
- will make the compilation slow, consider adding specific paths instead of
391
- whole parent directory if you just need to reference one or two modules
609
+ **Note:** Please be careful when adding paths here otherwise it will make the compilation slow, consider adding specific paths instead of whole parent directory if you just need to reference one or two modules
610
+
611
+ **Also note:** While importing assets living outside your `source_path` defined in webpacker.yml (like, for instance, assets under `app/assets`) from within your packs using _relative_ paths like `import '../../assets/javascripts/file.js'` will work in development, Webpacker won't recompile the bundle in production unless a file that lives in one of it's watched paths has changed (check out `Webpacker::Compiler#watched_files_digest`). That's why you'd need to add `app/assets` to the additional_paths as stated above and use `import 'javascripts/file.js'` instead.
612
+
392
613
 
393
614
  ## Deployment
394
615
 
@@ -396,25 +617,13 @@ Webpacker hooks up a new `webpacker:compile` task to `assets:precompile`, which
396
617
 
397
618
  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.
398
619
 
399
- ## Docs
400
-
401
- - [Development](https://github.com/rails/webpacker#development)
402
- - [Webpack](./docs/webpack.md)
403
- - [Webpack-dev-server](./docs/webpack-dev-server.md)
404
- - [Environment Variables](./docs/env.md)
405
- - [Folder Structure](./docs/folder-structure.md)
406
- - [Assets](./docs/assets.md) - [CSS, Sass and SCSS](./docs/css.md) - [ES6](./docs/es6.md), [Target browsers](./docs/target.md)
407
- - [Props](./docs/props.md)
408
- - [Typescript](./docs/typescript.md)
409
- - [Yarn](./docs/yarn.md)
410
- - [Misc](./docs/misc.md)
411
- - [Deployment](./docs/deployment.md)
412
- - [Docker](./docs/docker.md)
413
- - [Using in Rails engines](./docs/engines.md)
414
- - [Webpacker on Cloud9](./docs/cloud9.md)
415
- - [Testing](./docs/testing.md)
416
- - [Troubleshooting](./docs/troubleshooting.md)
417
- - [v3 to v4 Upgrade Guide](./docs/v4-upgrade.md)
620
+ If you are using a CDN setup, webpacker will use the configured [asset host](https://guides.rubyonrails.org/configuring.html#rails-general-configuration) value to prefix URLs for images or font icons which are included inside JS code or CSS. It is possible to override this value during asset compilation by setting the `WEBPACKER_ASSET_HOST` environment variable.
621
+
622
+
623
+ ## Troubleshooting
624
+
625
+ See the doc page for [Troubleshooting](./docs/troubleshooting.md).
626
+
418
627
 
419
628
  ## Contributing
420
629
 
@@ -422,6 +631,7 @@ When compiling assets for production on a remote server, such as a continuous in
422
631
 
423
632
  We encourage you to contribute to Webpacker! See [CONTRIBUTING](CONTRIBUTING.md) for guidelines about how to proceed.
424
633
 
634
+
425
635
  ## License
426
636
 
427
637
  Webpacker is released under the [MIT License](https://opensource.org/licenses/MIT).