webpacker 4.0.7 → 5.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +8 -8
  3. data/.github/workflows/jest.yml +38 -0
  4. data/.github/workflows/js-lint.yml +39 -0
  5. data/.github/workflows/rubocop.yml +39 -0
  6. data/.github/workflows/ruby.yml +46 -0
  7. data/.node-version +1 -1
  8. data/.rubocop.yml +118 -14
  9. data/CHANGELOG.md +301 -138
  10. data/CONTRIBUTING.md +1 -1
  11. data/Gemfile +1 -0
  12. data/Gemfile.lock +123 -92
  13. data/README.md +86 -211
  14. data/docs/css.md +72 -6
  15. data/docs/deployment.md +40 -11
  16. data/docs/docker.md +33 -14
  17. data/docs/engines.md +53 -3
  18. data/docs/env.md +0 -2
  19. data/docs/es6.md +19 -1
  20. data/docs/integrations.md +220 -0
  21. data/docs/target.md +22 -0
  22. data/docs/testing.md +2 -3
  23. data/docs/troubleshooting.md +39 -9
  24. data/docs/typescript.md +93 -26
  25. data/docs/webpack-dev-server.md +2 -2
  26. data/docs/webpack.md +18 -3
  27. data/gemfiles/Gemfile-rails-edge +1 -1
  28. data/gemfiles/{Gemfile-rails.4.2.x → Gemfile-rails.6.0.x} +1 -1
  29. data/lib/install/bin/webpack +0 -1
  30. data/lib/install/bin/webpack-dev-server +0 -1
  31. data/lib/install/coffee.rb +1 -1
  32. data/lib/install/config/babel.config.js +23 -13
  33. data/lib/install/config/webpacker.yml +3 -6
  34. data/lib/install/elm.rb +1 -1
  35. data/lib/install/erb.rb +2 -2
  36. data/lib/install/examples/angular/hello_angular/polyfills.ts +2 -2
  37. data/lib/install/examples/react/babel.config.js +28 -14
  38. data/lib/install/examples/react/tsconfig.json +2 -1
  39. data/lib/install/examples/svelte/app.svelte +11 -0
  40. data/lib/install/examples/svelte/hello_svelte.js +20 -0
  41. data/lib/install/examples/typescript/tsconfig.json +2 -1
  42. data/lib/install/loaders/elm.js +9 -6
  43. data/lib/install/loaders/svelte.js +9 -0
  44. data/lib/install/svelte.rb +29 -0
  45. data/lib/install/template.rb +14 -6
  46. data/lib/install/typescript.rb +6 -13
  47. data/lib/install/vue.rb +1 -1
  48. data/lib/tasks/installers.rake +1 -0
  49. data/lib/tasks/webpacker/check_node.rake +15 -8
  50. data/lib/tasks/webpacker/check_yarn.rake +16 -10
  51. data/lib/tasks/webpacker/clean.rake +25 -0
  52. data/lib/tasks/webpacker/clobber.rake +8 -4
  53. data/lib/tasks/webpacker/compile.rake +2 -10
  54. data/lib/tasks/webpacker/yarn_install.rake +11 -1
  55. data/lib/tasks/webpacker.rake +2 -0
  56. data/lib/webpacker/commands.rb +53 -1
  57. data/lib/webpacker/compiler.rb +21 -10
  58. data/lib/webpacker/configuration.rb +36 -13
  59. data/lib/webpacker/dev_server.rb +1 -1
  60. data/lib/webpacker/dev_server_proxy.rb +5 -9
  61. data/lib/webpacker/dev_server_runner.rb +6 -6
  62. data/lib/webpacker/env.rb +6 -2
  63. data/lib/webpacker/helper.rb +70 -25
  64. data/lib/webpacker/manifest.rb +4 -4
  65. data/lib/webpacker/railtie.rb +6 -43
  66. data/lib/webpacker/runner.rb +1 -0
  67. data/lib/webpacker/version.rb +1 -1
  68. data/lib/webpacker/webpack_runner.rb +2 -2
  69. data/lib/webpacker.rb +9 -1
  70. data/package/__tests__/config.js +12 -24
  71. data/package/__tests__/dev_server.js +2 -0
  72. data/package/__tests__/development.js +14 -1
  73. data/package/config.js +6 -11
  74. data/package/configPath.js +3 -0
  75. data/package/config_types/config_list.js +3 -3
  76. data/package/config_types/config_object.js +1 -1
  77. data/package/dev_server.js +1 -1
  78. data/package/env.js +1 -2
  79. data/package/environments/__tests__/base.js +29 -2
  80. data/package/environments/base.js +18 -8
  81. data/package/environments/development.js +39 -37
  82. data/package/environments/production.js +12 -2
  83. data/package/rules/babel.js +12 -5
  84. data/package/rules/file.js +3 -2
  85. data/package/rules/node_modules.js +3 -5
  86. data/package/rules/sass.js +11 -2
  87. data/package/utils/__tests__/get_style_rule.js +9 -0
  88. data/package/utils/deep_merge.js +5 -5
  89. data/package/utils/get_style_rule.js +7 -12
  90. data/package/utils/helpers.js +10 -10
  91. data/package.json +43 -43
  92. data/test/command_test.rb +6 -0
  93. data/test/compiler_test.rb +10 -6
  94. data/test/configuration_test.rb +40 -30
  95. data/test/dev_server_runner_test.rb +1 -1
  96. data/test/dev_server_test.rb +22 -0
  97. data/test/helper_test.rb +58 -9
  98. data/test/manifest_test.rb +37 -6
  99. data/test/rake_tasks_test.rb +17 -0
  100. data/test/test_app/app/javascript/packs/multi_entry.css +4 -0
  101. data/test/test_app/app/javascript/packs/multi_entry.js +4 -0
  102. data/test/test_app/bin/webpack +0 -1
  103. data/test/test_app/bin/webpack-dev-server +0 -1
  104. data/test/test_app/config/application.rb +0 -1
  105. data/test/test_app/config/webpacker.yml +8 -1
  106. data/test/test_app/public/packs/manifest.json +4 -0
  107. data/test/webpack_runner_test.rb +1 -1
  108. data/webpacker.gemspec +6 -4
  109. data/yarn.lock +4350 -4099
  110. metadata +63 -23
  111. data/.travis.yml +0 -53
  112. data/gemfiles/Gemfile-rails.5.0.x +0 -9
  113. data/gemfiles/Gemfile-rails.5.1.x +0 -9
  114. data/lib/install/loaders/typescript.js +0 -11
data/CHANGELOG.md CHANGED
@@ -1,10 +1,108 @@
1
1
  **Please note that Webpacker 3.1.0 and 3.1.1 have some serious bugs so please consider using either 3.0.2 or 3.2.0**
2
2
 
3
+ **Please note that Webpacker 4.1.0 has an installer bug. Please use 4.2.0 or above**
4
+
5
+ ## [[5.4.4]](https://github.com/rails/webpacker/compare/v5.4.3...v5.4.4) - 2023-01-31
6
+
7
+ - Fix compatibility with Ruby 3.2. (#3306)
8
+
9
+ ## [[5.4.3]](https://github.com/rails/webpacker/compare/v5.4.2...v5.4.3) - 2021-09-14
10
+
11
+ - Specify webpack-dev-server to be v3, to avoid getting webpack-dev-server v4 (#3121)
12
+
13
+ ## [[5.4.2]](https://github.com/rails/webpacker/compare/v5.4.1...v5.4.2) - 2021-08-20
14
+
15
+ - Fix babel warning about private-methods in @babel/plugin-proposal-private-property-in-object as well.
16
+
17
+ ## [[5.4.1]](https://github.com/rails/webpacker/compare/v5.4.0...v5.4.1) - 2021-08-20
18
+
19
+ - Update all dependencies within the same major version (#3120)
20
+
21
+ - Fix babel warning about private-methods (#3016)
22
+
23
+ ## [[5.4.0]](https://github.com/rails/webpacker/compare/v5.3.0...v5.4.0) - 2021-05-18
24
+
25
+ - Fix compatibility with Psych 4
26
+
27
+ ## [[5.3.0]](https://github.com/rails/webpacker/compare/v5.2.1...v5.3.0) - 2021-04-27
28
+
29
+ - Adds experimental Yarn 2 support. Note you must manually set `nodeLinker: node-modules` in your `.yarnrc.yml`.
30
+
31
+ - Keep backups, even when they're old [#2912](https://github.com/rails/webpacker/pull/2912)
32
+
33
+ ## [[5.2.2]](https://github.com/rails/webpacker/compare/v5.2.1...v5.2.2) - 2021-04-27
34
+
35
+ - Bump deps and remove node-sass [#2997](https://github.com/rails/webpacker/pull/2997).
36
+
37
+ ## [[5.2.1]](https://github.com/rails/webpacker/compare/v5.2.0...v5.2.1) - 2020-08-17
38
+
39
+ - Revert [#1311](https://github.com/rails/webpacker/pull/1311).
40
+
41
+ ## [[5.2.0]](https://github.com/rails/webpacker/compare/v5.1.1...v5.2.0) - 2020-08-16
42
+
43
+ - Bump dependencies and fixes. See [diff](https://github.com/rails/webpacker/compare/v5.1.1...5-x-stable) for changes.
44
+
45
+ ## [[5.1.1]](https://github.com/rails/webpacker/compare/v5.1.0...v5.1.1) - 2020-04-20
46
+
47
+ - Update [TypeScript documentation](https://github.com/rails/webpacker/blob/master/docs/typescript.md) and installer to use babel-loader for typescript.[(#2541](https://github.com/rails/webpacker/pull/2541)
48
+
49
+ ## [[5.1.0]](https://github.com/rails/webpacker/compare/v5.0.1...v5.1.0) - 2020-04-19
50
+
51
+ - Remove yarn integrity check [#2518](https://github.com/rails/webpacker/pull/2518)
52
+ - Switch from ts-loader to babel-loader [#2449](https://github.com/rails/webpacker/pull/2449)
53
+ Please see the [TypeScript documentation](https://github.com/rails/webpacker/blob/master/docs/typescript.md) to upgrade existing projects to use typescript with 5.1
54
+ - Resolve multi-word snakecase WEBPACKER_DEV_SERVER env values [#2528](https://github.com/rails/webpacker/pull/2528)
55
+
56
+ ## [[5.0.1]](https://github.com/rails/webpacker/compare/v5.0.0...v5.0.1) - 2020-03-22
57
+
58
+ - Upgrade deps and fix sass loader config options bug [#2508](https://github.com/rails/webpacker/pull/2508)
59
+
60
+ ## [[5.0.0]](https://github.com/rails/webpacker/compare/v4.2.2...v5.0.0) - 2020-03-22
61
+
62
+ - Bump minimum node version [#2428](https://github.com/rails/webpacker/pull/2428)
63
+ - Bump minimum ruby/rails version [#2415](https://github.com/rails/webpacker/pull/2415)
64
+ - Add support for multiple files per entry [#2476](https://github.com/rails/webpacker/pull/2476)
65
+
66
+ ```js
67
+ entry: {
68
+ home: ['./home.js', './home.scss'],
69
+ account: ['./account.js', './account.scss']
70
+ }
71
+ ```
72
+
73
+ You can now have two entry files with same names inside packs folder, `home.scss` and `home.js`
74
+
75
+ And, other minor fixes, please see a list of changes [here](https://github.com/rails/webpacker/compare/v4.2.2...v5.0.0)
76
+
77
+ ## [[4.2.2]](https://github.com/rails/webpacker/compare/v4.2.1...v4.2.2) - 2019-12-09
78
+
79
+ - Fixed issue with webpack clean task for nested assets [#2391](https://github.com/rails/webpacker/pull/2391)
80
+
81
+ ## [[4.2.1]](https://github.com/rails/webpacker/compare/v4.2.0...v4.2.1) - 2019-12-09
82
+
83
+ - Fixed issue with webpack clean task [#2389](https://github.com/rails/webpacker/pull/2389)
84
+
85
+ ## [[4.2.0]](https://github.com/rails/webpacker/compare/v4.1.0...v4.2.0) - 2019-11-12
86
+
87
+ - Fixed installer bug [#2366](https://github.com/rails/webpacker/pull/2366)
88
+
89
+ ## [[4.1.0]](https://github.com/rails/webpacker/compare/v4.0.7...v4.1.0) - 2019-11-12
90
+
91
+ - Added favicon_pack_tag to generate favicon links [#2281](https://github.com/rails/webpacker/pull/2281)
92
+ - Add support for Brotli compression [#2273](https://github.com/rails/webpacker/pull/2273)
93
+ - Support .(sass|scss).erb [#2259](https://github.com/rails/webpacker/pull/2259)
94
+ - Elm: Enable production optimizations when compiling in production [#2234](https://github.com/rails/webpacker/pull/2234)
95
+ - fixes webpacker:clean erroring because of nested hashes [#2318](https://github.com/rails/webpacker/pull/2318)
96
+ - Revert of production env enforcement [#2341](https://github.com/rails/webpacker/pull/2341)
97
+ - Add a preload_pack_asset helper [#2124](https://github.com/rails/webpacker/pull/2124)
98
+ - Record the compilation digest even on webpack error [#2117](https://github.com/rails/webpacker/pull/2117)
99
+ - See more changes [here](https://github.com/rails/webpacker/compare/v4.0.7...v4.1.0)
100
+
3
101
  ## [[4.0.7]](https://github.com/rails/webpacker/compare/v4.0.6...v4.0.7) - 2019-06-03
4
102
 
5
103
  - Prevent `@babel/plugin-transform-runtime` from rewriting babel helpers in core-js. Remove unneeded runtime `@babel/runtime-corejs3` [#2116](https://github.com/rails/webpacker/pull/2116)
6
- - Fix for: [#2109 Uncaught TypeError: __webpack_require__(...) is not a function](https://github.com/rails/webpacker/issues/2109): **If you are upgrading**, please check your `babel.config.js` against the [default `babel.config.js`](https://github.com/rails/webpacker/blob/master/lib/install/config/babel.config.js):
7
- - `@babel/preset-env` should contain `corejs: 3`
104
+ - Fix for: [#2109 Uncaught TypeError: **webpack_require**(...) is not a function](https://github.com/rails/webpacker/issues/2109): **If you are upgrading**, please check your `babel.config.js` against the [default `babel.config.js`](https://github.com/rails/webpacker/blob/master/lib/install/config/babel.config.js):
105
+ - `@babel/preset-env` should contain `corejs: 3`
8
106
  - `@babel/plugin-transform-runtime` should contain `corejs: false`
9
107
  - Removed unneeded runtime `@babel/runtime-corejs3`
10
108
 
@@ -26,22 +124,25 @@ Please see the diff
26
124
 
27
125
  ##### Breaking changes (for pre-existing apps)
28
126
 
29
- - [`@babel/polyfill`](https://babeljs.io/docs/en/next/babel-polyfill.html) [doesn't make it possible to provide a smooth migration path from `core-js@2` to `core-js@3`](https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#babelpolyfill): for this reason, it was decided to deprecate `@babel/polyfill` in favor of separate inclusion of required parts of `core-js` and `regenerator-runtime`. [#2031](https://github.com/rails/webpacker/pull/2031)
127
+ - [`@babel/polyfill`](https://babeljs.io/docs/en/next/babel-polyfill.html) [doesn't make it possible to provide a smooth migration path from `core-js@2` to `core-js@3`](https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#babelpolyfill): for this reason, it was decided to deprecate `@babel/polyfill` in favor of separate inclusion of required parts of `core-js` and `regenerator-runtime`. [#2031](https://github.com/rails/webpacker/pull/2031)
30
128
 
31
129
  In each of your `/packs/*.js` files, change this:
130
+
32
131
  ```js
33
- import "@babel/polyfill";
132
+ import '@babel/polyfill'
34
133
  ```
134
+
35
135
  to this:
136
+
36
137
  ```js
37
- import "core-js/stable";
38
- import "regenerator-runtime/runtime";
138
+ import 'core-js/stable'
139
+ import 'regenerator-runtime/runtime'
39
140
  ```
40
141
 
41
- Don't forget install those dependencies directly!
142
+ Don't forget to install those dependencies directly!
42
143
 
43
144
  ```sh
44
- yarn add --save core-js regenerator-runtime
145
+ yarn add core-js regenerator-runtime
45
146
  ```
46
147
 
47
148
  ## [4.0.2] - 2019-03-06
@@ -54,12 +155,10 @@ yarn add --save core-js regenerator-runtime
54
155
 
55
156
  - Pre-release version installer
56
157
 
57
-
58
158
  ## [4.0.0] - 2019-03-04
59
159
 
60
160
  No changes in this release. See RC releases for changes.
61
161
 
62
-
63
162
  ## [4.0.0.rc.8] - 2019-03-03
64
163
 
65
164
  ### Fixed
@@ -83,9 +182,9 @@ module.exports = environment.toWebpackConfig()
83
182
  - Reintroduced `context` to the file loader. Reverting the simpler paths change
84
183
 
85
184
  - Updated file loader to have filename based on the path. This change
86
- keeps the old behaviour intact i.e. let people use namespaces for media
87
- inside `app/javascript` and also include media outside of `app/javascript`
88
- with simpler paths, for example from `node_modules` or `app/assets`
185
+ keeps the old behaviour intact i.e. let people use namespaces for media
186
+ inside `app/javascript` and also include media outside of `app/javascript`
187
+ with simpler paths, for example from `node_modules` or `app/assets`
89
188
 
90
189
  ```bash
91
190
  # Files inside app/javascript (i.e. packs source path)
@@ -103,14 +202,12 @@ media/webfonts/fa-brands-400-4b115e11.woff2
103
202
  This change is done so we don't end up paths like `media/_/assets/images/rails_assets-f0f7bbb5ef00110a0dcef7c2cb7d34a6.png` or `media/_/_/node_modules/foo-f0f7bbb5ef00110a0dcef7c2cb7d34a6.png` for media outside of
104
203
  `app/javascript`
105
204
 
106
-
107
205
  ## [4.0.0.rc.7] - 2019-01-25
108
206
 
109
207
  ### Fixed
110
208
 
111
209
  - Webpacker builds test app assets [#1908](https://github.com/rails/webpacker/issues/1908)
112
210
 
113
-
114
211
  ## [4.0.0.rc.6] - 2019-01-25
115
212
 
116
213
  ### Fixed
@@ -156,12 +253,12 @@ fileLoader.use[0].options.context = join(config.source_path) // optional if you
156
253
 
157
254
  - Gems and node dependencies
158
255
 
159
-
160
256
  ## [4.0.0.rc.4] - 2019-01-21
161
257
 
162
258
  ### Added
163
- - `stylesheet_packs_with_chunks_tag` helper, similar to javascript helper but for
164
- loading stylesheets chunks.
259
+
260
+ - `stylesheet_packs_with_chunks_tag` helper, similar to javascript helper but for
261
+ loading stylesheets chunks.
165
262
 
166
263
  ```erb
167
264
  <%= stylesheet_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
@@ -182,15 +279,15 @@ helper otherwise you will get duplicated chunks on the page.
182
279
  # <%= stylesheet_packs_with_chunks_tag 'map' %>
183
280
  ```
184
281
 
185
-
186
282
  ## [4.0.0.rc.3] - 2019-01-17
187
283
 
188
284
  ### Fixed
189
- - Issue with javascript_pack_tag asset duplication [#1898](https://github.com/rails/webpacker/pull/1898)
190
285
 
286
+ - Issue with javascript_pack_tag asset duplication [#1898](https://github.com/rails/webpacker/pull/1898)
191
287
 
192
288
  ### Added
193
- - `javascript_packs_with_chunks_tag` helper, which creates html tags
289
+
290
+ - `javascript_packs_with_chunks_tag` helper, which creates html tags
194
291
  for a pack and all the dependent chunks, when using splitchunks.
195
292
 
196
293
  ```erb
@@ -218,68 +315,77 @@ helper otherwise you will get duplicated chunks on the page.
218
315
  ## [4.0.0.rc.2] - 2018-12-15
219
316
 
220
317
  ### Fixed
221
- - Disable integrity hash generation [#1835](https://github.com/rails/webpacker/issues/1835)
222
318
 
319
+ - Disable integrity hash generation [#1835](https://github.com/rails/webpacker/issues/1835)
223
320
 
224
321
  ## [4.0.0.rc.1] - 2018-12-14
225
322
 
226
323
  ### Breaking changes
227
324
 
228
- - Order of rules changed so you might have to change append to prepend,
325
+ - Order of rules changed so you might have to change append to prepend,
229
326
  depending on how you want to process packs [#1823](https://github.com/rails/webpacker/pull/1823)
230
- ```js
231
- environment.loaders.prepend()
232
- ```
233
- - Separate CSS extraction from build environment [#1625](https://github.com/rails/webpacker/pull/1625)
234
- ```yml
235
- # Extract and emit a css file
236
- extract_css: true
237
- ```
238
- - Separate rule to compile node modules
327
+
328
+ ```js
329
+ environment.loaders.prepend()
330
+ ```
331
+
332
+ - Separate CSS extraction from build environment [#1625](https://github.com/rails/webpacker/pull/1625)
333
+
334
+ ```yml
335
+ # Extract and emit a css file
336
+ extract_css: true
337
+ ```
338
+
339
+ - Separate rule to compile node modules
239
340
  (fixes cases where ES6 libraries were included in the app code) [#1823](https://github.com/rails/webpacker/pull/1823).
240
341
 
241
- In previous versions only application code was transpiled. Now everything in `node_modules` is transpiled with Babel. In some cases it could break your build (known issue with `mapbox-gl` package being broken by Babel, https://github.com/mapbox/mapbox-gl-js/issues/3422).
342
+ In previous versions only application code was transpiled. Now everything in `node_modules` is transpiled with Babel. In some cases it could break your build (known issue with `mapbox-gl` package being broken by Babel, https://github.com/mapbox/mapbox-gl-js/issues/3422).
242
343
 
243
- [`nodeModules` loader](https://github.com/rails/webpacker/pull/1823/files#diff-456094c8451b5774db50028dfecf4aa8) ignores `config.babel.js` and uses hard-coded `'@babel/preset-env', { modules: false }` config.
344
+ [`nodeModules` loader](https://github.com/rails/webpacker/pull/1823/files#diff-456094c8451b5774db50028dfecf4aa8) ignores `config.babel.js` and uses hard-coded `'@babel/preset-env', { modules: false }` config.
244
345
 
245
- To keep previous behavior, remove `nodeModules` loader specifying `environment.loaders.delete('nodeModules');` in your `config/webpack/environment.js` file.
346
+ To keep previous behavior, remove `nodeModules` loader specifying `environment.loaders.delete('nodeModules');` in your `config/webpack/environment.js` file.
246
347
 
247
- - File loader extensions API [#1823](https://github.com/rails/webpacker/pull/1823)
248
- ```yml
249
- # webpacker.yml
250
- static_assets_extensions:
251
- - .pdf
252
- # etc..
253
- ```
348
+ - File loader extensions API [#1823](https://github.com/rails/webpacker/pull/1823)
349
+
350
+ ```yml
351
+ # webpacker.yml
352
+ static_assets_extensions:
353
+ - .pdf
354
+ # etc..
355
+ ```
254
356
 
255
357
  ### Added
256
358
 
257
- - Move `.babelrc` and `.postcssrc` to `.js` variant [#1822](https://github.com/rails/webpacker/pull/1822)
258
- - Use postcss safe parser when optimising css assets [#1822](https://github.com/rails/webpacker/pull/1822)
259
- - Add split chunks api (undocumented)
260
- ```js
261
- const { environment } = require('@rails/webpacker')
262
- // Enable with default config
263
- environment.splitChunks()
264
- // Configure via a callback
265
- environment.splitChunks((config) => Object.assign({}, config, { optimization: { splitChunks: false }}))
266
- ```
267
- - Allow changing static file extensions using webpacker.yml (undocumented)
359
+ - Move `.babelrc` and `.postcssrc` to `.js` variant [#1822](https://github.com/rails/webpacker/pull/1822)
360
+ - Use postcss safe parser when optimising css assets [#1822](https://github.com/rails/webpacker/pull/1822)
361
+ - Add split chunks api (undocumented)
362
+
363
+ ```js
364
+ const { environment } = require('@rails/webpacker')
365
+ // Enable with default config
366
+ environment.splitChunks()
367
+ // Configure via a callback
368
+ environment.splitChunks((config) =>
369
+ Object.assign({}, config, { optimization: { splitChunks: false } })
370
+ )
371
+ ```
372
+
373
+ - Allow changing static file extensions using webpacker.yml (undocumented)
268
374
 
269
375
  ## [4.0.0-pre.3] - 2018-10-01
270
376
 
271
377
  ### Added
272
378
 
273
- - Move supported browsers configuration to [.browserslistrc](https://github.com/browserslist/browserslist#queries)
379
+ - Move supported browsers configuration to [.browserslistrc](https://github.com/browserslist/browserslist#queries)
274
380
 
275
381
  ### Breaking changes
276
382
 
277
- - postcss-next is replaced with postcss-preset-env
278
- - babel@7
383
+ - postcss-next is replaced with postcss-preset-env
384
+ - babel@7
279
385
 
280
386
  ### Fixed
281
387
 
282
- - Bring back test env [#1563](https://github.com/rails/webpacker/pull/1563)
388
+ - Bring back test env [#1563](https://github.com/rails/webpacker/pull/1563)
283
389
 
284
390
  Please see a list of [commits](https://github.com/rails/webpacker/compare/2dd68f0273074aadb3f869c4c30369d5e4e3fea7...master)
285
391
 
@@ -289,36 +395,82 @@ Please see a list of [commits](https://github.com/rails/webpacker/compare/2dd68f
289
395
 
290
396
  - Webpack dev server version in installer
291
397
 
292
-
293
398
  ## [4.0.0-pre.1] - 2018-04-2
294
399
 
295
400
  Pre-release to try out webpack 4.0 support
296
401
 
297
402
  ### Added
298
- - Webpack 4.0 support [#1376](https://github.com/rails/webpacker/pull/1316)
403
+
404
+ - Webpack 4.0 support [#1376](https://github.com/rails/webpacker/pull/1316)
405
+
406
+ ### Fixed
407
+
408
+ - Remove compilation digest file if webpack command fails[#1398](https://github.com/rails/webpacker/issues/1398)
409
+
410
+ ## [3.6.0] - 2019-03-06
411
+
412
+ See changes: https://github.com/rails/webpacker/compare/88a253ed42966eb2d5c997435e9396881513bce1...3-x-stable
413
+
414
+ ## [3.5.5] - 2018-07-09
415
+
416
+ See changes: https://github.com/rails/webpacker/compare/e8b197e36c77181ca2e4765c620faea59dcd0351...3-x-stable
417
+
418
+ ### Added
419
+
420
+ - On CI, sort files & check modified w/ digest intead of mtime[#1522](https://github.com/rails/webpacker/pull/1522)
421
+
422
+ ## [3.5.3] - 2018-05-03
423
+
424
+ ### Fixed
425
+
426
+ - Relax Javascript package dependencies [#1466](https://github.com/rails/webpacker/pull/1466#issuecomment-386336605)
427
+
428
+ ## [3.5.2] - 2018-04-29
429
+
430
+ - Pin Javascript package to 3.5.x
431
+
432
+ ## [3.5.1] - 2018-04-29
433
+
434
+ - Upgraded gems and Javascript packages
435
+
436
+ ## [3.5.0] - 2018-04-29
299
437
 
300
438
  ### Fixed
301
- - Remove compilation digest file if webpack command fails[#1398](https://github.com/rails/webpacker/issues/1398)
302
439
 
440
+ - Remove compilation digest file if webpack command fails [#1399](https://github.com/rails/webpacker/pull/1399)
441
+ - Handle http dev_server setting properly in the proxy [#1420](https://github.com/rails/webpacker/pull/1420)
442
+ - Use correct protocol [#1425](https://github.com/rails/webpacker/pull/1425)
443
+
444
+ ### Added
445
+
446
+ - `image_pack_tag` helper [#1400](https://github.com/rails/webpacker/pull/1400)
447
+ - devserver proxy for custom environments [#1415](https://github.com/rails/webpacker/pull/1415)
448
+ - Rails webpacker:info task [#1416](https://github.com/rails/webpacker/pull/1416)
449
+ - Include `RAILS_RELATIVE_URL_ROOT` environment variable in publicPath [#1428](https://github.com/rails/webpacker/pull/1428)
450
+
451
+ Complete list of changes: [#1464](https://github.com/rails/webpacker/pull/1464)
303
452
 
304
- Please refer to [3-x-stable](https://github.com/rails/webpacker/tree/3-x-stable) branch
305
- for further releases and changelogs:
453
+ ## [3.4.3] - 2018-04-3
454
+
455
+ ### Fixed
456
+
457
+ - Lock webpacker version in installer [#1401](https://github.com/rails/webpacker/issues/1401)
306
458
 
307
459
  ## [3.4.1] - 2018-03-24
308
460
 
309
461
  ### Fixed
310
- - Yarn integrity check in development [#1374](https://github.com/rails/webpacker/issues/1374)
311
462
 
463
+ - Yarn integrity check in development [#1374](https://github.com/rails/webpacker/issues/1374)
312
464
 
313
465
  ## [3.4.0] - 2018-03-23
314
466
 
315
467
  **Please use 3.4.1 instead**
316
468
 
317
469
  ### Added
318
- - Support for custom Rails environments [#1359](https://github.com/rails/webpacker/pull/1359)
319
470
 
320
- *This could break the compilation if you set NODE_ENV to custom environment. Now, NODE_ENV only understands production or development mode*
471
+ - Support for custom Rails environments [#1359](https://github.com/rails/webpacker/pull/1359)
321
472
 
473
+ _This could break the compilation if you set NODE_ENV to custom environment. Now, NODE_ENV only understands production or development mode_
322
474
 
323
475
  ## [3.3.1] - 2018-03-12
324
476
 
@@ -341,6 +493,7 @@ for further releases and changelogs:
341
493
  ```
342
494
  bundle exec rails webpacker:binstubs
343
495
  ```
496
+
344
497
  - set function is now removed from plugins and loaders, please use `append` or `prepend`
345
498
 
346
499
  ```js
@@ -354,6 +507,7 @@ environment.loaders.append('json', {
354
507
  ```
355
508
 
356
509
  ### Fixed
510
+
357
511
  - Limit ts-loader to 3.5.0 until webpack 4 support [#1308](https://github.com/rails/webpacker/pull/1308)
358
512
  - Custom env support [#1304](https://github.com/rails/webpacker/pull/1304)
359
513
 
@@ -387,7 +541,6 @@ And, bunch of bug fixes [See changes](https://github.com/rails/webpacker/compare
387
541
 
388
542
  - Revert file loader [#1196](https://github.com/rails/webpacker/pull/1196)
389
543
 
390
-
391
544
  ## [3.2.0] - 2017-12-16
392
545
 
393
546
  ### To upgrade:
@@ -417,11 +570,11 @@ into your `config/webpack/loaders/`
417
570
  directory and add it to webpack build from `config/webpack/environment.js`
418
571
 
419
572
  ```js
420
- const erb = require('./loaders/erb')
421
- const elm = require('./loaders/elm')
422
- const typescript = require('./loaders/typescript')
423
- const vue = require('./loaders/vue')
424
- const coffee = require('./loaders/coffee')
573
+ const erb = require('./loaders/erb')
574
+ const elm = require('./loaders/elm')
575
+ const typescript = require('./loaders/typescript')
576
+ const vue = require('./loaders/vue')
577
+ const coffee = require('./loaders/coffee')
425
578
 
426
579
  environment.loaders.append('coffee', coffee)
427
580
  environment.loaders.append('vue', vue)
@@ -444,19 +597,16 @@ plugins:
444
597
 
445
598
  - `postcss-import` in place of `postcss-smart-import`
446
599
 
447
-
448
600
  ### Removed (npm module)
449
601
 
450
602
  - `postcss-smart-import`, `coffee-loader`, `url-loader`, `rails-erb-loader` as dependencies
451
603
 
452
- - `publicPath` from file loader [#1107](https://github.com/rails/webpacker/pull/1107)
453
-
604
+ - `publicPath` from file loader [#1107](https://github.com/rails/webpacker/pull/1107)
454
605
 
455
606
  ### Fixed (npm module)
456
607
 
457
608
  - Return native array type for `ConfigList` [#1098](https://github.com/rails/webpacker/pull/1098)
458
609
 
459
-
460
610
  ### Added (Gem)
461
611
 
462
612
  - New `asset_pack_url` helper [#1102](https://github.com/rails/webpacker/pull/1102)
@@ -470,17 +620,14 @@ bundle exec rails webpacker:install:coffee
470
620
 
471
621
  - Resolved paths from webpacker.yml to compiler watched list
472
622
 
473
-
474
623
  ## [3.1.1] - 2017-12-11
475
624
 
476
625
  ### Fixed
477
626
 
478
627
  - Include default webpacker.yml config inside npm package
479
628
 
480
-
481
629
  ## [3.1.0] - 2017-12-11
482
630
 
483
-
484
631
  ### Added (npm module)
485
632
 
486
633
  - Expose base config from environment
@@ -490,7 +637,8 @@ environment.config.set('resolve.extensions', ['.foo', '.bar'])
490
637
  environment.config.set('output.filename', '[name].js')
491
638
  environment.config.delete('output.chunkFilename')
492
639
  environment.config.get('resolve')
493
- environment.config.merge({ output: {
640
+ environment.config.merge({
641
+ output: {
494
642
  filename: '[name].js'
495
643
  }
496
644
  })
@@ -499,7 +647,7 @@ environment.config.merge({ output: {
499
647
  - Expose new API's for loaders and plugins to insert at position
500
648
 
501
649
  ```js
502
- const jsonLoader = {
650
+ const jsonLoader = {
503
651
  test: /\.json$/,
504
652
  exclude: /node_modules/,
505
653
  loader: 'json-loader'
@@ -507,8 +655,8 @@ const jsonLoader = {
507
655
 
508
656
  environment.loaders.append('json', jsonLoader)
509
657
  environment.loaders.prepend('json', jsonLoader)
510
- environment.loaders.insert('json', jsonLoader, { after: 'style' } )
511
- environment.loaders.insert('json', jsonLoader, { before: 'babel' } )
658
+ environment.loaders.insert('json', jsonLoader, { after: 'style' })
659
+ environment.loaders.insert('json', jsonLoader, { before: 'babel' })
512
660
 
513
661
  // Update a plugin
514
662
  const manifestPlugin = environment.plugins.get('Manifest')
@@ -516,10 +664,14 @@ manifestPlugin.opts.writeToFileEmit = false
516
664
 
517
665
  // Update coffee loader to use coffeescript 2
518
666
  const babelLoader = environment.loaders.get('babel')
519
- environment.loaders.insert('coffee', {
520
- test: /\.coffee(\.erb)?$/,
521
- use: babelLoader.use.concat(['coffee-loader'])
522
- }, { before: 'json' })
667
+ environment.loaders.insert(
668
+ 'coffee',
669
+ {
670
+ test: /\.coffee(\.erb)?$/,
671
+ use: babelLoader.use.concat(['coffee-loader'])
672
+ },
673
+ { before: 'json' }
674
+ )
523
675
  ```
524
676
 
525
677
  - Expose `resolve.modules` paths like loaders and plugins
@@ -531,13 +683,15 @@ environment.resolvedModules.append('vendor', 'vendor')
531
683
  - Enable sourcemaps in `style` and `css` loader
532
684
 
533
685
  - Separate `css` and `sass` loader for easier configuration. `style` loader is now
534
- `css` loader, which resolves `.css` files and `sass` loader resolves `.scss` and `.sass`
535
- files.
686
+ `css` loader, which resolves `.css` files and `sass` loader resolves `.scss` and `.sass`
687
+ files.
536
688
 
537
689
  ```js
538
690
  // Enable css modules with sass loader
539
691
  const sassLoader = environment.loaders.get('sass')
540
- const cssLoader = sassLoader.use.find(loader => loader.loader === 'css-loader')
692
+ const cssLoader = sassLoader.use.find(
693
+ (loader) => loader.loader === 'css-loader'
694
+ )
541
695
 
542
696
  cssLoader.options = Object.assign({}, cssLoader.options, {
543
697
  modules: true,
@@ -568,7 +722,6 @@ dev_server:
568
722
 
569
723
  - Add url loader to process and embed smaller static files
570
724
 
571
-
572
725
  ### Removed
573
726
 
574
727
  - resolve url loader [#1042](https://github.com/rails/webpacker/issues/1042)
@@ -585,8 +738,7 @@ WEBPACKER_PRECOMPILE=false bundle exec rails assets:precompile
585
738
  - Use `WEBPACKER_ASSET_HOST` instead of `ASSET_HOST` for CDN
586
739
 
587
740
  - Alias `webpacker:compile` task to `assets:precompile` if is not defined so it works
588
- without sprockets
589
-
741
+ without sprockets
590
742
 
591
743
  ## [3.0.2] - 2017-10-04
592
744
 
@@ -621,7 +773,7 @@ Webpacker.manifest.lookup!('foo.js')
621
773
  - Inline CLI args for dev server binstub, use env variables instead
622
774
 
623
775
  - Coffeescript as core dependency. You have to manually add coffeescript now, if you are using
624
- it in your app.
776
+ it in your app.
625
777
 
626
778
  ```bash
627
779
  yarn add coffeescript@1.12.7
@@ -653,8 +805,7 @@ yarn add coffeescript
653
805
  ### Removed
654
806
 
655
807
  - `watchContentBase` from devServer config so it doesn't unncessarily trigger
656
- live reload when manifest changes. If you have applied this workaround from [#724](https://github.com/rails/webpacker/issues/724), please revert the change from `config/webpack/development.js` since this is now fixed.
657
-
808
+ live reload when manifest changes. If you have applied this workaround from [#724](https://github.com/rails/webpacker/issues/724), please revert the change from `config/webpack/development.js` since this is now fixed.
658
809
 
659
810
  ## [3.0.0] - 2017-08-30
660
811
 
@@ -663,9 +814,9 @@ live reload when manifest changes. If you have applied this workaround from [#72
663
814
  - `resolved_paths` option to allow adding additional paths webpack should lookup when resolving modules
664
815
 
665
816
  ```yml
666
- # config/webpacker.yml
667
- # Additional paths webpack should lookup modules
668
- resolved_paths: [] # empty by default
817
+ # config/webpacker.yml
818
+ # Additional paths webpack should lookup modules
819
+ resolved_paths: [] # empty by default
669
820
  ```
670
821
 
671
822
  - `Webpacker::Compiler.fresh?` and `Webpacker::Compiler.stale?` answer the question of whether compilation is needed.
@@ -718,8 +869,8 @@ live reload when manifest changes. If you have applied this workaround from [#72
718
869
  - Serve assets using `localhost` from dev server - [#424](https://github.com/rails/webpacker/issues/424)
719
870
 
720
871
  ```yml
721
- dev_server:
722
- host: localhost
872
+ dev_server:
873
+ host: localhost
723
874
  ```
724
875
 
725
876
  - On Windows, `ruby bin/webpacker` and `ruby bin/webpacker-dev-server` will now bypass yarn, and execute via `node_modules/.bin` directly - [#584](https://github.com/rails/webpacker/pull/584)
@@ -729,21 +880,21 @@ live reload when manifest changes. If you have applied this workaround from [#72
729
880
  - Add `compile` and `cache_path` options to `config/webpacker.yml` for configuring lazy compilation of packs when a file under tracked paths is changed [#503](https://github.com/rails/webpacker/pull/503). To enable expected behavior, update `config/webpacker.yml`:
730
881
 
731
882
  ```yaml
732
- default: &default
733
- cache_path: tmp/cache/webpacker
734
- test:
735
- compile: true
883
+ default: &default
884
+ cache_path: tmp/cache/webpacker
885
+ test:
886
+ compile: true
736
887
 
737
- development:
738
- compile: true
888
+ development:
889
+ compile: true
739
890
 
740
- production:
741
- compile: false
891
+ production:
892
+ compile: false
742
893
  ```
743
894
 
744
895
  - Make test compilation cacheable and configurable so that the lazy compilation
745
- only triggers if files are changed under tracked paths.
746
- Following paths are watched by default -
896
+ only triggers if files are changed under tracked paths.
897
+ Following paths are watched by default -
747
898
 
748
899
  ```rb
749
900
  ["app/javascript/**/*", "yarn.lock", "package.json", "config/webpack/**/*"]
@@ -759,6 +910,7 @@ Following paths are watched by default -
759
910
  ## [2.0] - 2017-05-24
760
911
 
761
912
  ### Fixed
913
+
762
914
  - Update `.babelrc` to fix compilation issues - [#306](https://github.com/rails/webpacker/issues/306)
763
915
 
764
916
  - Duplicated asset hosts - [#320](https://github.com/rails/webpacker/issues/320), [#397](https://github.com/rails/webpacker/pull/397)
@@ -771,24 +923,28 @@ Following paths are watched by default -
771
923
 
772
924
  - ARGV support for `webpack-dev-server` - [#286](https://github.com/rails/webpacker/issues/286)
773
925
 
774
-
775
926
  ### Added
927
+
776
928
  - [Elm](http://elm-lang.org) support. You can now add Elm support via the following methods:
929
+
777
930
  - New app: `rails new <app> --webpack=elm`
778
931
  - Within an existing app: `rails webpacker:install:elm`
779
932
 
780
933
  - Support for custom `public_output_path` paths independent of `source_entry_path` in `config/webpacker.yml`. `output` is also now relative to `public/`. - [#397](https://github.com/rails/webpacker/pull/397)
781
934
 
782
- Before (compile to `public/packs`):
783
- ```yaml
784
- source_entry_path: packs
785
- public_output_path: packs
786
- ```
787
- After (compile to `public/sweet/js`):
788
- ```yaml
789
- source_entry_path: packs
790
- public_output_path: sweet/js
791
- ```
935
+ Before (compile to `public/packs`):
936
+
937
+ ```yaml
938
+ source_entry_path: packs
939
+ public_output_path: packs
940
+ ```
941
+
942
+ After (compile to `public/sweet/js`):
943
+
944
+ ```yaml
945
+ source_entry_path: packs
946
+ public_output_path: sweet/js
947
+ ```
792
948
 
793
949
  - `https` option to use `https` mode, particularly on platforms like - https://community.c9.io/t/running-a-rails-app/1615 or locally - [#176](https://github.com/rails/webpacker/issues/176)
794
950
 
@@ -797,26 +953,29 @@ Following paths are watched by default -
797
953
  ```json
798
954
  {
799
955
  "presets": [
800
- ["env", {
801
- "modules": false,
802
- "targets": {
803
- "browsers": "> 1%",
804
- "uglify": true
805
- },
806
- "useBuiltIns": true
807
- }]
956
+ [
957
+ "env",
958
+ {
959
+ "modules": false,
960
+ "targets": {
961
+ "browsers": "> 1%",
962
+ "uglify": true
963
+ },
964
+ "useBuiltIns": true
965
+ }
966
+ ]
808
967
  ],
809
968
 
810
969
  "plugins": [
811
970
  "syntax-dynamic-import",
812
- "transform-class-properties", { "spec": true }
971
+ "transform-class-properties",
972
+ { "spec": true }
813
973
  ]
814
974
  }
815
975
  ```
816
976
 
817
977
  - Source-map support for production bundle
818
978
 
819
-
820
979
  #### Breaking Change
821
980
 
822
981
  - Consolidate and flatten `paths.yml` and `development.server.yml` config into one file - `config/webpacker.yml` - [#403](https://github.com/rails/webpacker/pull/403). This is a breaking change and requires you to re-install webpacker and cleanup old configuration files.
@@ -831,14 +990,16 @@ Following paths are watched by default -
831
990
  rm config/webpack/development.server.js
832
991
  ```
833
992
 
834
- __Warning__: For now you also have to add a pattern in `.gitignore` by hand.
993
+ **Warning**: For now you also have to add a pattern in `.gitignore` by hand.
994
+
835
995
  ```diff
836
996
  /public/packs
837
997
  +/public/packs-test
838
998
  /node_modules
839
- ```
999
+ ```
840
1000
 
841
1001
  ## [1.2] - 2017-04-27
1002
+
842
1003
  Some of the changes made requires you to run below commands to install new changes.
843
1004
 
844
1005
  ```
@@ -846,13 +1007,14 @@ bundle update webpacker
846
1007
  bundle exec rails webpacker:install
847
1008
  ```
848
1009
 
849
-
850
1010
  ### Fixed
1011
+
851
1012
  - Support Spring - [#205](https://github.com/rails/webpacker/issues/205)
852
1013
 
853
1014
  ```ruby
854
1015
  Spring.after_fork { Webpacker.bootstrap } if defined?(Spring)
855
1016
  ```
1017
+
856
1018
  - Check node version and yarn before installing webpacker - [#217](https://github.com/rails/webpacker/issues/217)
857
1019
 
858
1020
  - Include webpacker helper to views - [#172](https://github.com/rails/webpacker/issues/172)
@@ -865,27 +1027,28 @@ bundle exec rails webpacker:install
865
1027
 
866
1028
  - Move babel presets and plugins to .babelrc - [#202](https://github.com/rails/webpacker/issues/202)
867
1029
 
868
-
869
1030
  ### Added
1031
+
870
1032
  - A changelog - [#211](https://github.com/rails/webpacker/issues/211)
871
1033
  - Minimize CSS assets - [#218](https://github.com/rails/webpacker/issues/218)
872
1034
  - Pack namespacing support - [#201](https://github.com/rails/webpacker/pull/201)
873
1035
 
874
1036
  For example:
1037
+
875
1038
  ```
876
1039
  app/javascript/packs/admin/hello_vue.js
877
1040
  app/javascript/packs/admin/hello.vue
878
1041
  app/javascript/packs/hello_vue.js
879
1042
  app/javascript/packs/hello.vue
880
1043
  ```
1044
+
881
1045
  - Add tree-shaking support - [#250](https://github.com/rails/webpacker/pull/250)
882
1046
  - Add initial test case by @kimquy [#259](https://github.com/rails/webpacker/pull/259)
883
1047
  - Compile assets before test:controllers and test:system
884
1048
 
885
-
886
1049
  ### Removed
887
- - Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)
888
1050
 
1051
+ - Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)
889
1052
 
890
1053
  ## [1.1] - 2017-03-24
891
1054
 
@@ -900,10 +1063,10 @@ bundle exec rails webpacker:install:[react, angular, vue]
900
1063
  ```
901
1064
 
902
1065
  ### Added (breaking changes)
1066
+
903
1067
  - Static assets support - [#153](https://github.com/rails/webpacker/pull/153)
904
1068
  - Advanced webpack configuration - [#153](https://github.com/rails/webpacker/pull/153)
905
1069
 
906
-
907
1070
  ### Removed
908
1071
 
909
1072
  ```rb