webpacker 5.4.0 → 6.0.0.rc.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) 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 -36
  7. data/.gitignore +2 -0
  8. data/.node-version +1 -1
  9. data/.rubocop.yml +5 -4
  10. data/CHANGELOG.md +45 -9
  11. data/CONTRIBUTING.md +20 -1
  12. data/Gemfile.lock +83 -83
  13. data/README.md +394 -180
  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-edge +1 -1
  21. data/gemfiles/Gemfile-rails.6.1.x +12 -0
  22. data/lib/install/{javascript/packs/application.js → application.js} +2 -5
  23. data/lib/install/bin/webpack +4 -7
  24. data/lib/install/bin/yarn +18 -0
  25. data/lib/install/config/webpack/base.js +3 -0
  26. data/lib/install/config/webpack/development.js +2 -2
  27. data/lib/install/config/webpack/production.js +2 -2
  28. data/lib/install/config/webpack/test.js +2 -2
  29. data/lib/install/config/webpacker.yml +21 -49
  30. data/lib/install/package.json +15 -0
  31. data/lib/install/template.rb +63 -28
  32. data/lib/tasks/webpacker/binstubs.rake +6 -4
  33. data/lib/tasks/webpacker/check_binstubs.rake +4 -4
  34. data/lib/tasks/webpacker/check_node.rake +3 -0
  35. data/lib/tasks/webpacker/check_yarn.rake +4 -1
  36. data/lib/tasks/webpacker/clobber.rake +1 -1
  37. data/lib/tasks/webpacker/compile.rake +4 -2
  38. data/lib/tasks/webpacker/info.rake +12 -10
  39. data/lib/tasks/webpacker/install.rake +6 -4
  40. data/lib/tasks/webpacker/verify_config.rake +14 -0
  41. data/lib/tasks/webpacker/verify_install.rake +1 -10
  42. data/lib/tasks/webpacker/yarn_install.rake +9 -7
  43. data/lib/tasks/webpacker.rake +2 -11
  44. data/lib/tasks/yarn.rake +38 -0
  45. data/lib/webpacker/commands.rb +21 -16
  46. data/lib/webpacker/compiler.rb +16 -9
  47. data/lib/webpacker/configuration.rb +8 -32
  48. data/lib/webpacker/dev_server.rb +6 -0
  49. data/lib/webpacker/dev_server_runner.rb +28 -4
  50. data/lib/webpacker/helper.rb +47 -81
  51. data/lib/webpacker/instance.rb +4 -0
  52. data/lib/webpacker/manifest.rb +2 -3
  53. data/lib/webpacker/railtie.rb +8 -2
  54. data/lib/webpacker/runner.rb +1 -1
  55. data/lib/webpacker/version.rb +1 -1
  56. data/lib/webpacker/webpack_runner.rb +29 -3
  57. data/lib/webpacker.rb +1 -1
  58. data/package/__tests__/config.js +5 -37
  59. data/package/__tests__/development.js +13 -21
  60. data/package/__tests__/env.js +16 -4
  61. data/package/__tests__/index.js +9 -0
  62. data/package/__tests__/production.js +6 -6
  63. data/package/__tests__/staging.js +7 -6
  64. data/package/__tests__/test.js +4 -5
  65. data/package/babel/preset.js +54 -0
  66. data/package/config.js +6 -14
  67. data/package/env.js +13 -4
  68. data/package/environments/__tests__/base.js +20 -52
  69. data/package/environments/base.js +68 -128
  70. data/package/environments/development.js +49 -47
  71. data/package/environments/production.js +66 -64
  72. data/package/environments/test.js +2 -2
  73. data/package/index.js +15 -8
  74. data/package/inliningCss.js +7 -0
  75. data/package/rules/babel.js +10 -8
  76. data/package/rules/coffee.js +6 -0
  77. data/package/rules/erb.js +15 -0
  78. data/package/rules/file.js +21 -19
  79. data/package/rules/index.js +16 -18
  80. data/package/rules/less.js +22 -0
  81. data/package/rules/raw.js +5 -0
  82. data/package/rules/sass.js +9 -10
  83. data/package/rules/stylus.js +26 -0
  84. data/package/utils/get_style_rule.js +28 -36
  85. data/package/utils/helpers.js +28 -35
  86. data/package.json +23 -43
  87. data/test/command_test.rb +76 -0
  88. data/test/compiler_test.rb +0 -12
  89. data/test/configuration_test.rb +4 -35
  90. data/test/dev_server_runner_test.rb +36 -6
  91. data/test/engine_rake_tasks_test.rb +39 -0
  92. data/test/helper_test.rb +76 -62
  93. data/test/manifest_test.rb +16 -0
  94. data/test/mounted_app/Rakefile +4 -0
  95. data/test/mounted_app/test/dummy/Rakefile +3 -0
  96. data/test/mounted_app/test/dummy/bin/rails +3 -0
  97. data/test/mounted_app/test/dummy/bin/rake +3 -0
  98. data/test/mounted_app/test/dummy/config/application.rb +10 -0
  99. data/test/mounted_app/test/dummy/config/environment.rb +3 -0
  100. data/test/mounted_app/test/dummy/config/webpacker.yml +75 -0
  101. data/test/mounted_app/test/dummy/config.ru +5 -0
  102. data/test/mounted_app/test/dummy/package.json +7 -0
  103. data/test/rake_tasks_test.rb +1 -10
  104. data/test/test_app/app/{javascript/packs → packs/entrypoints}/application.js +1 -1
  105. data/test/test_app/config/initializers/inspect_autoload_paths.rb +1 -0
  106. data/test/test_app/config/webpacker.yml +5 -31
  107. data/test/test_app/config/webpacker_other_location.yml +79 -0
  108. data/test/test_app/config/webpacker_public_root.yml +0 -1
  109. data/test/test_app/public/packs/manifest.json +36 -18
  110. data/test/test_app/some.config.js +0 -0
  111. data/test/webpack_runner_test.rb +9 -3
  112. data/test/webpacker_test.rb +21 -0
  113. data/webpacker.gemspec +2 -2
  114. data/yarn.lock +2183 -6524
  115. metadata +63 -93
  116. data/.travis.yml +0 -43
  117. data/docs/assets.md +0 -119
  118. data/docs/cloud9.md +0 -310
  119. data/docs/css.md +0 -308
  120. data/docs/docker.md +0 -68
  121. data/docs/engines.md +0 -213
  122. data/docs/env.md +0 -63
  123. data/docs/es6.md +0 -72
  124. data/docs/folder-structure.md +0 -66
  125. data/docs/integrations.md +0 -220
  126. data/docs/misc.md +0 -23
  127. data/docs/props.md +0 -223
  128. data/docs/target.md +0 -22
  129. data/docs/testing.md +0 -136
  130. data/docs/typescript.md +0 -190
  131. data/docs/v4-upgrade.md +0 -142
  132. data/docs/webpack-dev-server.md +0 -92
  133. data/docs/webpack.md +0 -364
  134. data/docs/yarn.md +0 -23
  135. data/lib/install/angular.rb +0 -23
  136. data/lib/install/coffee.rb +0 -25
  137. data/lib/install/config/.browserslistrc +0 -1
  138. data/lib/install/config/babel.config.js +0 -70
  139. data/lib/install/config/postcss.config.js +0 -12
  140. data/lib/install/config/webpack/environment.js +0 -3
  141. data/lib/install/elm.rb +0 -39
  142. data/lib/install/erb.rb +0 -25
  143. data/lib/install/examples/angular/hello_angular/app/app.component.ts +0 -9
  144. data/lib/install/examples/angular/hello_angular/app/app.module.ts +0 -16
  145. data/lib/install/examples/angular/hello_angular/index.ts +0 -8
  146. data/lib/install/examples/angular/hello_angular/polyfills.ts +0 -73
  147. data/lib/install/examples/angular/hello_angular.js +0 -7
  148. data/lib/install/examples/coffee/hello_coffee.coffee +0 -4
  149. data/lib/install/examples/elm/Main.elm +0 -55
  150. data/lib/install/examples/elm/hello_elm.js +0 -16
  151. data/lib/install/examples/erb/hello_erb.js.erb +0 -6
  152. data/lib/install/examples/react/babel.config.js +0 -87
  153. data/lib/install/examples/react/hello_react.jsx +0 -26
  154. data/lib/install/examples/react/tsconfig.json +0 -21
  155. data/lib/install/examples/stimulus/application.js +0 -1
  156. data/lib/install/examples/stimulus/controllers/hello_controller.js +0 -18
  157. data/lib/install/examples/stimulus/controllers/index.js +0 -9
  158. data/lib/install/examples/svelte/app.svelte +0 -11
  159. data/lib/install/examples/svelte/hello_svelte.js +0 -20
  160. data/lib/install/examples/typescript/hello_typescript.ts +0 -4
  161. data/lib/install/examples/typescript/tsconfig.json +0 -24
  162. data/lib/install/examples/vue/app.vue +0 -22
  163. data/lib/install/examples/vue/hello_vue.js +0 -72
  164. data/lib/install/loaders/coffee.js +0 -6
  165. data/lib/install/loaders/elm.js +0 -25
  166. data/lib/install/loaders/erb.js +0 -11
  167. data/lib/install/loaders/svelte.js +0 -9
  168. data/lib/install/loaders/vue.js +0 -6
  169. data/lib/install/react.rb +0 -18
  170. data/lib/install/stimulus.rb +0 -12
  171. data/lib/install/svelte.rb +0 -29
  172. data/lib/install/typescript.rb +0 -39
  173. data/lib/install/vue.rb +0 -49
  174. data/lib/tasks/installers.rake +0 -42
  175. data/package/config_types/__tests__/config_list.js +0 -118
  176. data/package/config_types/__tests__/config_object.js +0 -43
  177. data/package/config_types/config_list.js +0 -75
  178. data/package/config_types/config_object.js +0 -55
  179. data/package/config_types/index.js +0 -7
  180. data/package/rules/module.css.js +0 -3
  181. data/package/rules/module.sass.js +0 -8
  182. data/package/rules/node_modules.js +0 -22
  183. data/package/utils/__tests__/deep_assign.js +0 -32
  184. data/package/utils/__tests__/deep_merge.js +0 -10
  185. data/package/utils/__tests__/get_style_rule.js +0 -65
  186. data/package/utils/__tests__/objectify.js +0 -9
  187. data/package/utils/deep_assign.js +0 -22
  188. data/package/utils/deep_merge.js +0 -22
  189. data/package/utils/objectify.js +0 -3
  190. /data/test/test_app/app/{javascript/packs → packs/entrypoints}/multi_entry.css +0 -0
  191. /data/test/test_app/app/{javascript/packs → packs/entrypoints}/multi_entry.js +0 -0
data/README.md CHANGED
@@ -1,19 +1,19 @@
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.17.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%2012.0.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/)
9
- to manage application-like JavaScript in Rails. It coexists with the asset pipeline,
10
- as the primary purpose for webpack is app-like JavaScript, not images, CSS, or
11
- even JavaScript Sprinkles (that all continues to live in app/assets).
12
-
13
- However, it is possible to use Webpacker for CSS, images and fonts assets as well,
14
- in which case you may not even need the asset pipeline. This is mostly relevant when exclusively using component-based JavaScript frameworks.
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.
15
15
 
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.
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
 
18
18
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
19
19
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
@@ -22,27 +22,29 @@ in which case you may not even need the asset pipeline. This is mostly relevant
22
22
 
23
23
  - [Prerequisites](#prerequisites)
24
24
  - [Features](#features)
25
+ - [Optional support](#optional-support)
25
26
  - [Installation](#installation)
26
27
  - [Usage](#usage)
28
+ - [Server-Side Rendering (SSR)](#server-side-rendering-ssr)
27
29
  - [Development](#development)
28
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)
29
42
  - [Custom Rails environments](#custom-rails-environments)
30
43
  - [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
- - [Typescript](./docs/typescript.md)
39
- - [CoffeeScript](./docs/integrations.md#coffeescript)
40
- - [Erb](./docs/integrations.md#erb)
41
44
  - [Paths](#paths)
42
- - [Resolved](#resolved)
43
- - [Watched](#watched)
45
+ - [Additional paths](#additional-paths)
44
46
  - [Deployment](#deployment)
45
- - [Docs](#docs)
47
+ - [Troubleshooting](#troubleshooting)
46
48
  - [Contributing](#contributing)
47
49
  - [License](#license)
48
50
 
@@ -52,59 +54,52 @@ in which case you may not even need the asset pipeline. This is mostly relevant
52
54
 
53
55
  - Ruby 2.4+
54
56
  - Rails 5.2+
55
- - Node.js 10.17.0+
56
- - Yarn 1.x+
57
+ - Node.js 12.13.0+ || 14+
58
+ - Yarn
57
59
 
58
60
  ## Features
59
61
 
60
- - [webpack 4.x.x](https://webpack.js.org/)
62
+ - [Webpack v5](https://webpack.js.org/)
61
63
  - ES6 with [babel](https://babeljs.io/)
62
64
  - Automatic code splitting using multiple entry points
63
- - Stylesheets - Sass and CSS
64
- - Images and fonts
65
- - PostCSS - Auto-Prefixer
66
65
  - Asset compression, source-maps, and minification
67
66
  - CDN support
68
- - React, Angular, Elm and Vue support out-of-the-box
69
67
  - Rails view helpers
70
68
  - Extensible and configurable
71
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
+
72
79
  ## Installation
73
80
 
74
- You can either add Webpacker during setup of a new Rails 5.1+ application
75
- using new `--webpack` option:
81
+ You can configure a new Rails application with Webpacker right from the start using the `-j webpack` option:
76
82
 
77
83
  ```bash
78
- # Available Rails 5.1+
79
- rails new myapp --webpack
84
+ rails new myapp -j webpack
80
85
  ```
81
86
 
82
- Or add it to your `Gemfile`:
87
+ Or you can add it later by changing your `Gemfile`:
83
88
 
84
89
  ```ruby
85
90
  # Gemfile
86
- gem 'webpacker', '~> 5.x'
91
+ gem 'webpacker', '~> 6.0'
87
92
 
88
93
  # OR if you prefer to use master
89
94
  gem 'webpacker', git: 'https://github.com/rails/webpacker.git'
90
95
  yarn add https://github.com/rails/webpacker.git
91
- yarn add core-js regenerator-runtime
92
- ```
93
-
94
- Finally, run the following to install Webpacker:
95
-
96
- ```bash
97
- bundle
98
- bundle exec rails webpacker:install
99
-
100
- # OR (on rails version < 5.0)
101
- bundle exec rake webpacker:install
102
96
  ```
103
97
 
104
- Optional: To fix ["unmet peer dependency" warnings](https://github.com/rails/webpacker/issues/1078),
98
+ Then running the following to install Webpacker:
105
99
 
106
100
  ```bash
107
- yarn upgrade
101
+ ./bin/bundle install
102
+ ./bin/rails webpacker:install
108
103
  ```
109
104
 
110
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:
@@ -119,10 +114,9 @@ Once installed, you can start writing modern ES6-flavored JavaScript apps right
119
114
 
120
115
  ```yml
121
116
  app/javascript:
122
- ├── packs:
123
- │ # only webpack entry files here
124
- └── application.js
125
- │ └── application.css
117
+ # Only Webpack entry files here
118
+ └── application.js
119
+ └── application.css
126
120
  └── src:
127
121
  │ └── my_component.js
128
122
  └── stylesheets:
@@ -131,102 +125,116 @@ app/javascript:
131
125
  └── logo.svg
132
126
  ```
133
127
 
134
- In `/packs/application.js`, include this at the top of the file:
135
-
136
- ```js
137
- import 'core-js/stable'
138
- import 'regenerator-runtime/runtime'
139
- ```
140
-
141
- You can then link the JavaScript pack in Rails views using the `javascript_pack_tag` helper.
142
- 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`:
143
129
 
144
130
  ```erb
145
131
  <%= javascript_pack_tag 'application' %>
146
132
  <%= stylesheet_pack_tag 'application' %>
147
133
  ```
148
134
 
149
- If you want to link a static asset for `<link rel="prefetch">` or `<img />` tag, you
150
- 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:
151
139
 
152
140
  ```erb
153
- <link rel="prefetch" href="<%= asset_pack_path 'application.css' %>" />
154
- <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>
155
148
  ```
156
149
 
157
- If you are using new webpack 4 split chunks API, then consider using `javascript_packs_with_chunks_tag` helper, which creates html
158
- 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
+ ```
159
163
 
164
+ If you want to link a static asset for `<img />` tag, you can use the `asset_pack_path` helper:
160
165
  ```erb
161
- <%= javascript_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
166
+ <img src="<%= asset_pack_path 'images/logo.svg' %>" />
167
+ ```
162
168
 
163
- <script src="/packs/vendor-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
164
- <script src="/packs/calendar~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
165
- <script src="/packs/calendar-1016838bab065ae1e314.js" data-turbolinks-track="reload"></script>
166
- <script src="/packs/map~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
167
- <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' } %>
168
173
  ```
169
174
 
170
- **Important:** Pass all your pack names when using `javascript_packs_with_chunks_tag`
171
- 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
+ ```
172
179
 
180
+ If you want to preload a static asset in your `<head>`, you can use the `preload_pack_asset` helper:
173
181
  ```erb
174
- <%# DO %>
175
- <%= javascript_packs_with_chunks_tag 'calendar', 'map' %>
182
+ <%= preload_pack_asset 'fonts/fa-regular-400.woff2' %>
183
+ ```
176
184
 
177
- <%# DON'T %>
178
- <%= javascript_packs_with_chunks_tag 'calendar' %>
179
- <%= 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
+ }
180
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`.
181
194
 
182
- **Note:** In order for your styles or static assets files to be available in your view,
183
- you would need to link them in your "pack" or entry file.
195
+ #### Server-Side Rendering (SSR)
196
+
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.
184
200
 
185
201
  ### Development
186
202
 
187
- Webpacker ships with two binstubs: `./bin/webpack` and `./bin/webpack-dev-server`.
188
- Both are thin wrappers around the standard `webpack.js` and `webpack-dev-server.js`
189
- executables to ensure that the right configuration files and environmental variables
190
- 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.
191
204
 
192
- In development, Webpacker compiles on demand rather than upfront by default. This
193
- happens when you refer to any of the pack assets using the Webpacker helper methods.
194
- This means that you don't have to run any separate processes. Compilation errors are logged
195
- 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`
196
206
 
197
- 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
198
- in a terminal separate from `bundle exec rails s`. This process will watch for changes
199
- 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/).
200
208
 
201
209
  ```bash
202
210
  # webpack dev server
203
211
  ./bin/webpack-dev-server
204
212
 
205
213
  # watcher
206
- ./bin/webpack --watch --colors --progress
214
+ ./bin/webpack --watch --progress
207
215
 
208
216
  # standalone build
209
- ./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
210
227
  ```
211
228
 
212
- Once you start this development server, Webpacker will automatically start proxying all
213
- webpack asset requests to this server. When you stop the server, it'll revert back to
214
- 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`
215
230
 
216
- You can use environment variables as options supported by
217
- [webpack-dev-server](https://webpack.js.org/configuration/dev-server/) in the
218
- form `WEBPACKER_DEV_SERVER_<OPTION>`. Please note that these environmental
219
- variables will always take precedence over the ones already set in the
220
- configuration file, and that the _same_ environmental variables must
221
- 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.
222
232
 
223
233
  ```bash
224
234
  WEBPACKER_DEV_SERVER_HOST=example.com WEBPACKER_DEV_SERVER_INLINE=true WEBPACKER_DEV_SERVER_HOT=false ./bin/webpack-dev-server
225
235
  ```
226
236
 
227
- By default, the webpack dev server listens on `localhost` in development for security purposes.
228
- However, if you want your app to be available over local LAN IP or a VM instance like vagrant,
229
- 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:
230
238
 
231
239
  ```bash
232
240
  WEBPACKER_DEV_SERVER_HOST=0.0.0.0 ./bin/webpack-dev-server
@@ -235,16 +243,254 @@ WEBPACKER_DEV_SERVER_HOST=0.0.0.0 ./bin/webpack-dev-server
235
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:
236
244
 
237
245
  ```ruby
238
- Rails.application.config.content_security_policy do |policy|
239
- policy.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' if Rails.env.development?
240
- 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
241
249
  ```
242
250
 
243
251
  **Note:** Don't forget to prefix `ruby` when running these binstubs on Windows
244
252
 
253
+
245
254
  ### Webpack Configuration
246
255
 
247
- 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
+
248
494
 
249
495
  ### Custom Rails environments
250
496
 
@@ -266,8 +512,7 @@ staging:
266
512
  public_output_path: packs-staging
267
513
  ```
268
514
 
269
- 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`.
270
- 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`.
271
516
 
272
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:
273
518
 
@@ -275,22 +520,20 @@ For example, the below command will compile assets in production mode but will u
275
520
  RAILS_ENV=staging bundle exec rails assets:precompile
276
521
  ```
277
522
 
278
- And, this will compile in development mode and load configuration for cucumber environment
279
- 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
280
524
 
281
525
  ```bash
282
526
  RAILS_ENV=cucumber NODE_ENV=development bundle exec rails assets:precompile
283
527
  ```
284
528
 
285
- Please note, binstubs compiles in development mode however rake tasks
286
- compiles in production mode.
529
+ Please note, binstubs compiles in development mode however rake tasks compiles in production mode.
287
530
 
288
531
  ```bash
289
- # Compiles in development mode unless NODE_ENV is specified
532
+ # Compiles in development mode unless NODE_ENV is specified, per the binstub source
290
533
  ./bin/webpack
291
534
  ./bin/webpack-dev-server
292
535
 
293
- # 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`
294
537
  bundle exec rails assets:precompile
295
538
  bundle exec rails webpacker:compile
296
539
  ```
@@ -300,53 +543,37 @@ bundle exec rails webpacker:compile
300
543
  You can run following commands to upgrade Webpacker to the latest stable version. This process involves upgrading the gem and related JavaScript packages:
301
544
 
302
545
  ```bash
546
+ # check your Gemfile for version restrictions
303
547
  bundle update webpacker
304
- 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
305
553
  yarn upgrade @rails/webpacker --latest
306
554
  yarn upgrade webpack-dev-server --latest
307
555
 
556
+ # yarn 2 instructions
557
+ yarn up @rails/webpacker@latest
558
+ yarn up webpack-dev-server@latest
559
+
308
560
  # Or to install the latest release (including pre-releases)
309
561
  yarn add @rails/webpacker@next
310
562
  ```
311
563
 
312
- ## Integrations
313
-
314
- Webpacker ships with basic out-of-the-box integration. You can see a list of available commands/tasks by running `bundle exec rails webpacker`.
315
-
316
- Included install integrations:
317
-
318
- - [React](./docs/integrations.md#React)
319
- - [Angular with TypeScript](./docs/integrations.md#Angular-with-TypeScript)
320
- - [Vue](./docs/integrations.md#Vue)
321
- - [Elm](./docs/integrations.md#Elm)
322
- - [Svelte](./docs/integrations.md#Svelte)
323
- - [Stimulus](./docs/integrations.md#Stimulus)
324
- - [CoffeeScript](./docs/integrations.md#CoffeeScript)
325
- - [Typescript](./docs/typescript.md)
326
- - [Erb](./docs/integrations.md#Erb)
327
-
328
- See [Integrations](./docs/integrations.md) for further details.
564
+ Also, consult the [CHANGELOG](./CHANGELOG.md) for additional upgrade links.
329
565
 
330
566
  ## Paths
331
567
 
332
- By default, Webpacker ships with simple conventions for where the JavaScript
333
- app files and compiled webpack bundles will go in your Rails app.
334
- 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.
335
569
 
336
- The configuration for what webpack is supposed to compile by default rests
337
- on the convention that every file in `app/javascript/packs/*`**(default)**
338
- or whatever path you set for `source_entry_path` in the `webpacker.yml` configuration
339
- 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
340
- an entry file. As a rule of thumb, put all files you want to link in your views inside
341
- "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`.
342
571
 
343
- Suppose you want to change the source directory from `app/javascript`
344
- 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:
345
573
 
346
574
  ```yml
347
575
  # config/webpacker.yml
348
- source_path: frontend
349
- source_entry_path: packs
576
+ source_path: frontend # packs are in frontend/packs
350
577
  public_output_path: assets/packs # outputs to => public/assets/packs
351
578
  ```
352
579
 
@@ -362,16 +589,13 @@ development:
362
589
 
363
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.
364
591
 
365
- ### Resolved
592
+ ### Additional paths
366
593
 
367
- If you are adding Webpacker to an existing app that has most of the assets inside
368
- `app/assets` or inside an engine, and you want to share that
369
- with webpack modules, you can use the `additional_paths`
370
- option available in `config/webpacker.yml`. This lets you
371
- 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:
372
596
 
373
597
  ```yml
374
- additional_paths: ['app/assets']
598
+ additional_paths: ['app/assets', 'vendor/assets']
375
599
  ```
376
600
 
377
601
  You can then import these items inside your modules like so:
@@ -382,9 +606,10 @@ import 'stylesheets/main'
382
606
  import 'images/rails.png'
383
607
  ```
384
608
 
385
- **Note:** Please be careful when adding paths here otherwise it
386
- will make the compilation slow, consider adding specific paths instead of
387
- 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
+
388
613
 
389
614
  ## Deployment
390
615
 
@@ -392,25 +617,13 @@ Webpacker hooks up a new `webpacker:compile` task to `assets:precompile`, which
392
617
 
393
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.
394
619
 
395
- ## Docs
396
-
397
- - [Development](https://github.com/rails/webpacker#development)
398
- - [Webpack](./docs/webpack.md)
399
- - [Webpack-dev-server](./docs/webpack-dev-server.md)
400
- - [Environment Variables](./docs/env.md)
401
- - [Folder Structure](./docs/folder-structure.md)
402
- - [Assets](./docs/assets.md) - [CSS, Sass and SCSS](./docs/css.md) - [ES6](./docs/es6.md), [Target browsers](./docs/target.md)
403
- - [Props](./docs/props.md)
404
- - [Typescript](./docs/typescript.md)
405
- - [Yarn](./docs/yarn.md)
406
- - [Misc](./docs/misc.md)
407
- - [Deployment](./docs/deployment.md)
408
- - [Docker](./docs/docker.md)
409
- - [Using in Rails engines](./docs/engines.md)
410
- - [Webpacker on Cloud9](./docs/cloud9.md)
411
- - [Testing](./docs/testing.md)
412
- - [Troubleshooting](./docs/troubleshooting.md)
413
- - [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
+
414
627
 
415
628
  ## Contributing
416
629
 
@@ -418,6 +631,7 @@ When compiling assets for production on a remote server, such as a continuous in
418
631
 
419
632
  We encourage you to contribute to Webpacker! See [CONTRIBUTING](CONTRIBUTING.md) for guidelines about how to proceed.
420
633
 
634
+
421
635
  ## License
422
636
 
423
637
  Webpacker is released under the [MIT License](https://opensource.org/licenses/MIT).