webpacker 4.0.7 → 4.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.node-version +1 -1
  3. data/.rubocop.yml +2 -1
  4. data/.travis.yml +7 -4
  5. data/CHANGELOG.md +226 -137
  6. data/Gemfile.lock +78 -59
  7. data/README.md +110 -3
  8. data/docs/css.md +12 -0
  9. data/docs/deployment.md +38 -9
  10. data/docs/docker.md +25 -6
  11. data/docs/engines.md +40 -3
  12. data/docs/es6.md +19 -1
  13. data/docs/troubleshooting.md +37 -9
  14. data/docs/typescript.md +8 -5
  15. data/docs/webpack-dev-server.md +1 -1
  16. data/docs/webpack.md +18 -3
  17. data/gemfiles/Gemfile-rails.6.0.x +9 -0
  18. data/lib/install/bin/webpack +0 -1
  19. data/lib/install/bin/webpack-dev-server +0 -1
  20. data/lib/install/coffee.rb +1 -1
  21. data/lib/install/config/babel.config.js +10 -10
  22. data/lib/install/config/webpacker.yml +2 -1
  23. data/lib/install/elm.rb +1 -1
  24. data/lib/install/erb.rb +2 -2
  25. data/lib/install/examples/angular/hello_angular/polyfills.ts +2 -2
  26. data/lib/install/examples/react/babel.config.js +16 -14
  27. data/lib/install/examples/svelte/app.svelte +11 -0
  28. data/lib/install/examples/svelte/hello_svelte.js +20 -0
  29. data/lib/install/loaders/elm.js +9 -6
  30. data/lib/install/loaders/svelte.js +9 -0
  31. data/lib/install/loaders/typescript.js +1 -1
  32. data/lib/install/svelte.rb +29 -0
  33. data/lib/install/template.rb +1 -1
  34. data/lib/install/typescript.rb +1 -1
  35. data/lib/install/vue.rb +1 -1
  36. data/lib/tasks/installers.rake +1 -0
  37. data/lib/tasks/webpacker.rake +2 -0
  38. data/lib/tasks/webpacker/clean.rake +19 -0
  39. data/lib/tasks/webpacker/compile.rake +2 -10
  40. data/lib/tasks/webpacker/yarn_install.rake +15 -0
  41. data/lib/webpacker.rb +9 -1
  42. data/lib/webpacker/commands.rb +29 -1
  43. data/lib/webpacker/compiler.rb +15 -8
  44. data/lib/webpacker/configuration.rb +9 -1
  45. data/lib/webpacker/dev_server.rb +1 -1
  46. data/lib/webpacker/dev_server_proxy.rb +2 -8
  47. data/lib/webpacker/env.rb +1 -1
  48. data/lib/webpacker/helper.rb +39 -13
  49. data/lib/webpacker/railtie.rb +6 -0
  50. data/lib/webpacker/version.rb +1 -1
  51. data/package.json +36 -36
  52. data/package/__tests__/config.js +0 -23
  53. data/package/config.js +2 -10
  54. data/package/config_types/config_list.js +3 -3
  55. data/package/config_types/config_object.js +1 -1
  56. data/package/environments/base.js +2 -2
  57. data/package/environments/development.js +1 -1
  58. data/package/environments/production.js +12 -0
  59. data/package/rules/babel.js +1 -1
  60. data/package/rules/node_modules.js +2 -2
  61. data/package/rules/sass.js +1 -1
  62. data/package/utils/__tests__/get_style_rule.js +9 -0
  63. data/package/utils/deep_merge.js +5 -5
  64. data/package/utils/get_style_rule.js +7 -12
  65. data/package/utils/helpers.js +9 -9
  66. data/test/command_test.rb +6 -0
  67. data/test/compiler_test.rb +5 -6
  68. data/test/configuration_test.rb +36 -27
  69. data/test/dev_server_test.rb +22 -0
  70. data/test/helper_test.rb +34 -0
  71. data/test/rake_tasks_test.rb +6 -0
  72. data/test/test_app/bin/webpack +0 -1
  73. data/test/test_app/bin/webpack-dev-server +0 -1
  74. data/test/test_app/config/webpacker.yml +1 -0
  75. data/test/test_app/public/packs/manifest.json +3 -0
  76. data/webpacker.gemspec +1 -0
  77. data/yarn.lock +1934 -1634
  78. metadata +24 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60145540340af7d04e9ad62a395b3b6a282585d2d470a7b23427da53c8784fa4
4
- data.tar.gz: b7b9fe64a3b2481733e40e198506c9a75d65feac46b1eb5b9cd2cc752a86c943
3
+ metadata.gz: 123810c157dda2d179ec4c3b27701cf29ade3fbf5a122d08eab68fa6b8c4b8a7
4
+ data.tar.gz: 6c120aead9282b96fbf070c216d0c2395249deea3ee135f764299d96fd14b423
5
5
  SHA512:
6
- metadata.gz: 8f35a4d16a608ef7ec30ab763a743b0664cc49c339bc3f4afe7e96fbc9ffa474dd38eb11020c994621407354399a9a309c839be4801dcfeac841a126e5834c83
7
- data.tar.gz: c325bbf4849a5fbc9f09e459d77d05011621afb8bcc11704697d53e9950b90ae222b5fa97d69990ffc3ddc66227f37b5d283b12bc5844eebb946611b0fba8915
6
+ metadata.gz: 04ede9ec043442d4d59a06e60f04fef3483531df5f1f6afbcc175f4252132421b7bd852c637e1be1427508799c5065fad0ea7fe47d5322f56435951a3142b932
7
+ data.tar.gz: 3ac3f4e8b995982861fa0e5d0771e8244c2f644245dfb8b02b0abccaf3e1485f4677bcd978ac509ebbba2817555ead6d8f92ab9ac02e8ec95c5205b43ac5f7a7
@@ -1 +1 @@
1
- 6.14.4
1
+ 8.16.0
@@ -1,3 +1,4 @@
1
+ require: rubocop-performance
1
2
  AllCops:
2
3
  TargetRubyVersion: 2.2
3
4
  # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
@@ -71,7 +72,7 @@ Layout/SpaceAroundOperators:
71
72
  Enabled: true
72
73
 
73
74
  Layout/SpaceBeforeFirstArg:
74
- Enabled: true
75
+ Enabled: true
75
76
 
76
77
  # Defining a method with parameters needs parentheses.
77
78
  Style/MethodDefParentheses:
@@ -1,5 +1,4 @@
1
1
  language: ruby
2
- bundler_args: --jobs 3 --retry 3
3
2
  dist: xenial
4
3
  before_install:
5
4
  - gem install rubygems-update && update_rubygems
@@ -7,19 +6,19 @@ before_install:
7
6
  # v1.17.3. This is just for Ruby 2.5 which ships with bundler 2.x on Travis
8
7
  # CI while Ruby 2.6 does not.
9
8
  # https://github.com/travis-ci/travis-rubies/issues/57#issuecomment-458981237
10
- - yes | rvm @global do gem uninstall bundler --all
11
9
  - yes | rvm @global do gem install bundler -v 1.17.3 || true
12
10
  rvm:
13
11
  - 2.3.8
14
12
  - 2.4.6
15
13
  - 2.5.5
16
- - 2.6.2
14
+ - 2.6.3
17
15
  - ruby-head
18
16
  gemfile:
19
17
  - gemfiles/Gemfile-rails.4.2.x
20
18
  - gemfiles/Gemfile-rails.5.0.x
21
19
  - gemfiles/Gemfile-rails.5.1.x
22
20
  - gemfiles/Gemfile-rails.5.2.x
21
+ - gemfiles/Gemfile-rails.6.0.x
23
22
  - gemfiles/Gemfile-rails-edge
24
23
  cache:
25
24
  bundler: true
@@ -28,7 +27,7 @@ cache:
28
27
  yarn: true
29
28
 
30
29
  install:
31
- - bundle install
30
+ - bundle install --jobs 3 --retry 3
32
31
  - nvm install 10
33
32
  - node -v
34
33
  - npm i -g yarn
@@ -51,3 +50,7 @@ matrix:
51
50
  gemfile: gemfiles/Gemfile-rails-edge
52
51
  - rvm: ruby-head
53
52
  gemfile: gemfiles/Gemfile-rails.4.2.x
53
+ - rvm: 2.3.8
54
+ gemfile: gemfiles/Gemfile-rails.6.0.x
55
+ - rvm: 2.4.6
56
+ gemfile: gemfiles/Gemfile-rails.6.0.x
@@ -1,10 +1,36 @@
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
+ ## [[4.2.2]](https://github.com/rails/webpacker/compare/v4.2.1...v4.2.2) - 2019-12-09
6
+
7
+ - Fixed issue with webpack clean task for nested assets [#2391](https://github.com/rails/webpacker/pull/2391)
8
+
9
+ ## [[4.2.1]](https://github.com/rails/webpacker/compare/v4.2.0...v4.2.1) - 2019-12-09
10
+
11
+ - Fixed issue with webpack clean task [#2389](https://github.com/rails/webpacker/pull/2389)
12
+
13
+ ## [[4.2.0]](https://github.com/rails/webpacker/compare/v4.1.0...v4.2.0) - 2019-11-12
14
+
15
+ - Fixed installer bug [#2366](https://github.com/rails/webpacker/pull/2366)
16
+
17
+ ## [[4.1.0]](https://github.com/rails/webpacker/compare/v4.0.7...v4.1.0) - 2019-11-12
18
+
19
+ - Added favicon_pack_tag to generate favicon links [#2281](https://github.com/rails/webpacker/pull/2281)
20
+ - Add support for Brotli compression [#2273](https://github.com/rails/webpacker/pull/2273)
21
+ - Support .(sass|scss).erb [#2259](https://github.com/rails/webpacker/pull/2259)
22
+ - Elm: Enable production optimizations when compiling in production [#2234](https://github.com/rails/webpacker/pull/2234)
23
+ - fixes webpacker:clean erroring because of nested hashes [#2318](https://github.com/rails/webpacker/pull/2318)
24
+ - Revert of production env enforcement [#2341](https://github.com/rails/webpacker/pull/2341)
25
+ - Add a preload_pack_asset helper [#2124](https://github.com/rails/webpacker/pull/2124)
26
+ - Record the compilation digest even on webpack error [#2117](https://github.com/rails/webpacker/pull/2117)
27
+ - See more changes [here](https://github.com/rails/webpacker/compare/v4.0.7...v4.1.0)
28
+
3
29
  ## [[4.0.7]](https://github.com/rails/webpacker/compare/v4.0.6...v4.0.7) - 2019-06-03
4
30
 
5
31
  - 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`
32
+ - 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):
33
+ - `@babel/preset-env` should contain `corejs: 3`
8
34
  - `@babel/plugin-transform-runtime` should contain `corejs: false`
9
35
  - Removed unneeded runtime `@babel/runtime-corejs3`
10
36
 
@@ -26,22 +52,25 @@ Please see the diff
26
52
 
27
53
  ##### Breaking changes (for pre-existing apps)
28
54
 
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)
55
+ - [`@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
56
 
31
57
  In each of your `/packs/*.js` files, change this:
58
+
32
59
  ```js
33
- import "@babel/polyfill";
60
+ import '@babel/polyfill'
34
61
  ```
62
+
35
63
  to this:
64
+
36
65
  ```js
37
- import "core-js/stable";
38
- import "regenerator-runtime/runtime";
66
+ import 'core-js/stable'
67
+ import 'regenerator-runtime/runtime'
39
68
  ```
40
69
 
41
- Don't forget install those dependencies directly!
70
+ Don't forget to install those dependencies directly!
42
71
 
43
72
  ```sh
44
- yarn add --save core-js regenerator-runtime
73
+ yarn add core-js regenerator-runtime
45
74
  ```
46
75
 
47
76
  ## [4.0.2] - 2019-03-06
@@ -54,12 +83,10 @@ yarn add --save core-js regenerator-runtime
54
83
 
55
84
  - Pre-release version installer
56
85
 
57
-
58
86
  ## [4.0.0] - 2019-03-04
59
87
 
60
88
  No changes in this release. See RC releases for changes.
61
89
 
62
-
63
90
  ## [4.0.0.rc.8] - 2019-03-03
64
91
 
65
92
  ### Fixed
@@ -83,9 +110,9 @@ module.exports = environment.toWebpackConfig()
83
110
  - Reintroduced `context` to the file loader. Reverting the simpler paths change
84
111
 
85
112
  - 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`
113
+ keeps the old behaviour intact i.e. let people use namespaces for media
114
+ inside `app/javascript` and also include media outside of `app/javascript`
115
+ with simpler paths, for example from `node_modules` or `app/assets`
89
116
 
90
117
  ```bash
91
118
  # Files inside app/javascript (i.e. packs source path)
@@ -103,14 +130,12 @@ media/webfonts/fa-brands-400-4b115e11.woff2
103
130
  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
131
  `app/javascript`
105
132
 
106
-
107
133
  ## [4.0.0.rc.7] - 2019-01-25
108
134
 
109
135
  ### Fixed
110
136
 
111
137
  - Webpacker builds test app assets [#1908](https://github.com/rails/webpacker/issues/1908)
112
138
 
113
-
114
139
  ## [4.0.0.rc.6] - 2019-01-25
115
140
 
116
141
  ### Fixed
@@ -156,12 +181,12 @@ fileLoader.use[0].options.context = join(config.source_path) // optional if you
156
181
 
157
182
  - Gems and node dependencies
158
183
 
159
-
160
184
  ## [4.0.0.rc.4] - 2019-01-21
161
185
 
162
186
  ### Added
163
- - `stylesheet_packs_with_chunks_tag` helper, similar to javascript helper but for
164
- loading stylesheets chunks.
187
+
188
+ - `stylesheet_packs_with_chunks_tag` helper, similar to javascript helper but for
189
+ loading stylesheets chunks.
165
190
 
166
191
  ```erb
167
192
  <%= stylesheet_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
@@ -182,15 +207,15 @@ helper otherwise you will get duplicated chunks on the page.
182
207
  # <%= stylesheet_packs_with_chunks_tag 'map' %>
183
208
  ```
184
209
 
185
-
186
210
  ## [4.0.0.rc.3] - 2019-01-17
187
211
 
188
212
  ### Fixed
189
- - Issue with javascript_pack_tag asset duplication [#1898](https://github.com/rails/webpacker/pull/1898)
190
213
 
214
+ - Issue with javascript_pack_tag asset duplication [#1898](https://github.com/rails/webpacker/pull/1898)
191
215
 
192
216
  ### Added
193
- - `javascript_packs_with_chunks_tag` helper, which creates html tags
217
+
218
+ - `javascript_packs_with_chunks_tag` helper, which creates html tags
194
219
  for a pack and all the dependent chunks, when using splitchunks.
195
220
 
196
221
  ```erb
@@ -218,68 +243,77 @@ helper otherwise you will get duplicated chunks on the page.
218
243
  ## [4.0.0.rc.2] - 2018-12-15
219
244
 
220
245
  ### Fixed
221
- - Disable integrity hash generation [#1835](https://github.com/rails/webpacker/issues/1835)
222
246
 
247
+ - Disable integrity hash generation [#1835](https://github.com/rails/webpacker/issues/1835)
223
248
 
224
249
  ## [4.0.0.rc.1] - 2018-12-14
225
250
 
226
251
  ### Breaking changes
227
252
 
228
- - Order of rules changed so you might have to change append to prepend,
253
+ - Order of rules changed so you might have to change append to prepend,
229
254
  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
255
+
256
+ ```js
257
+ environment.loaders.prepend()
258
+ ```
259
+
260
+ - Separate CSS extraction from build environment [#1625](https://github.com/rails/webpacker/pull/1625)
261
+
262
+ ```yml
263
+ # Extract and emit a css file
264
+ extract_css: true
265
+ ```
266
+
267
+ - Separate rule to compile node modules
239
268
  (fixes cases where ES6 libraries were included in the app code) [#1823](https://github.com/rails/webpacker/pull/1823).
240
269
 
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).
270
+ 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
271
 
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.
272
+ [`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
273
 
245
- To keep previous behavior, remove `nodeModules` loader specifying `environment.loaders.delete('nodeModules');` in your `config/webpack/environment.js` file.
274
+ To keep previous behavior, remove `nodeModules` loader specifying `environment.loaders.delete('nodeModules');` in your `config/webpack/environment.js` file.
246
275
 
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
- ```
276
+ - File loader extensions API [#1823](https://github.com/rails/webpacker/pull/1823)
277
+
278
+ ```yml
279
+ # webpacker.yml
280
+ static_assets_extensions:
281
+ - .pdf
282
+ # etc..
283
+ ```
254
284
 
255
285
  ### Added
256
286
 
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)
287
+ - Move `.babelrc` and `.postcssrc` to `.js` variant [#1822](https://github.com/rails/webpacker/pull/1822)
288
+ - Use postcss safe parser when optimising css assets [#1822](https://github.com/rails/webpacker/pull/1822)
289
+ - Add split chunks api (undocumented)
290
+
291
+ ```js
292
+ const { environment } = require('@rails/webpacker')
293
+ // Enable with default config
294
+ environment.splitChunks()
295
+ // Configure via a callback
296
+ environment.splitChunks(config =>
297
+ Object.assign({}, config, { optimization: { splitChunks: false } })
298
+ )
299
+ ```
300
+
301
+ - Allow changing static file extensions using webpacker.yml (undocumented)
268
302
 
269
303
  ## [4.0.0-pre.3] - 2018-10-01
270
304
 
271
305
  ### Added
272
306
 
273
- - Move supported browsers configuration to [.browserslistrc](https://github.com/browserslist/browserslist#queries)
307
+ - Move supported browsers configuration to [.browserslistrc](https://github.com/browserslist/browserslist#queries)
274
308
 
275
309
  ### Breaking changes
276
310
 
277
- - postcss-next is replaced with postcss-preset-env
278
- - babel@7
311
+ - postcss-next is replaced with postcss-preset-env
312
+ - babel@7
279
313
 
280
314
  ### Fixed
281
315
 
282
- - Bring back test env [#1563](https://github.com/rails/webpacker/pull/1563)
316
+ - Bring back test env [#1563](https://github.com/rails/webpacker/pull/1563)
283
317
 
284
318
  Please see a list of [commits](https://github.com/rails/webpacker/compare/2dd68f0273074aadb3f869c4c30369d5e4e3fea7...master)
285
319
 
@@ -289,36 +323,82 @@ Please see a list of [commits](https://github.com/rails/webpacker/compare/2dd68f
289
323
 
290
324
  - Webpack dev server version in installer
291
325
 
292
-
293
326
  ## [4.0.0-pre.1] - 2018-04-2
294
327
 
295
328
  Pre-release to try out webpack 4.0 support
296
329
 
297
330
  ### Added
298
- - Webpack 4.0 support [#1376](https://github.com/rails/webpacker/pull/1316)
331
+
332
+ - Webpack 4.0 support [#1376](https://github.com/rails/webpacker/pull/1316)
299
333
 
300
334
  ### Fixed
301
- - Remove compilation digest file if webpack command fails[#1398](https://github.com/rails/webpacker/issues/1398)
302
335
 
336
+ - Remove compilation digest file if webpack command fails[#1398](https://github.com/rails/webpacker/issues/1398)
337
+
338
+ ## [3.6.0] - 2019-03-06
339
+
340
+ See changes: https://github.com/rails/webpacker/compare/88a253ed42966eb2d5c997435e9396881513bce1...3-x-stable
341
+
342
+ ## [3.5.5] - 2018-07-09
343
+
344
+ See changes: https://github.com/rails/webpacker/compare/e8b197e36c77181ca2e4765c620faea59dcd0351...3-x-stable
345
+
346
+ ### Added
347
+
348
+ - On CI, sort files & check modified w/ digest intead of mtime[#1522](https://github.com/rails/webpacker/pull/1522)
349
+
350
+ ## [3.5.3] - 2018-05-03
351
+
352
+ ### Fixed
353
+
354
+ - Relax Javascript package dependencies [#1466](https://github.com/rails/webpacker/pull/1466#issuecomment-386336605)
355
+
356
+ ## [3.5.2] - 2018-04-29
357
+
358
+ - Pin Javascript package to 3.5.x
303
359
 
304
- Please refer to [3-x-stable](https://github.com/rails/webpacker/tree/3-x-stable) branch
305
- for further releases and changelogs:
360
+ ## [3.5.1] - 2018-04-29
361
+
362
+ - Upgraded gems and Javascript packages
363
+
364
+ ## [3.5.0] - 2018-04-29
365
+
366
+ ### Fixed
367
+
368
+ - Remove compilation digest file if webpack command fails [#1399](https://github.com/rails/webpacker/pull/1399)
369
+ - Handle http dev_server setting properly in the proxy [#1420](https://github.com/rails/webpacker/pull/1420)
370
+ - Use correct protocol [#1425](https://github.com/rails/webpacker/pull/1425)
371
+
372
+ ### Added
373
+
374
+ - `image_pack_tag` helper [#1400](https://github.com/rails/webpacker/pull/1400)
375
+ - devserver proxy for custom environments [#1415](https://github.com/rails/webpacker/pull/1415)
376
+ - Rails webpacker:info task [#1416](https://github.com/rails/webpacker/pull/1416)
377
+ - Include `RAILS_RELATIVE_URL_ROOT` environment variable in publicPath [#1428](https://github.com/rails/webpacker/pull/1428)
378
+
379
+ Complete list of changes: [#1464](https://github.com/rails/webpacker/pull/1464)
380
+
381
+ ## [3.4.3] - 2018-04-3
382
+
383
+ ### Fixed
384
+
385
+ - Lock webpacker version in installer [#1401](https://github.com/rails/webpacker/issues/1401)
306
386
 
307
387
  ## [3.4.1] - 2018-03-24
308
388
 
309
389
  ### Fixed
310
- - Yarn integrity check in development [#1374](https://github.com/rails/webpacker/issues/1374)
311
390
 
391
+ - Yarn integrity check in development [#1374](https://github.com/rails/webpacker/issues/1374)
312
392
 
313
393
  ## [3.4.0] - 2018-03-23
314
394
 
315
395
  **Please use 3.4.1 instead**
316
396
 
317
397
  ### Added
318
- - Support for custom Rails environments [#1359](https://github.com/rails/webpacker/pull/1359)
319
398
 
320
- *This could break the compilation if you set NODE_ENV to custom environment. Now, NODE_ENV only understands production or development mode*
399
+ - Support for custom Rails environments [#1359](https://github.com/rails/webpacker/pull/1359)
321
400
 
401
+ _This could break the compilation if you set NODE_ENV to custom environment. Now, NODE_ENV only understands production or development mode_
322
402
 
323
403
  ## [3.3.1] - 2018-03-12
324
404
 
@@ -341,6 +421,7 @@ for further releases and changelogs:
341
421
  ```
342
422
  bundle exec rails webpacker:binstubs
343
423
  ```
424
+
344
425
  - set function is now removed from plugins and loaders, please use `append` or `prepend`
345
426
 
346
427
  ```js
@@ -354,6 +435,7 @@ environment.loaders.append('json', {
354
435
  ```
355
436
 
356
437
  ### Fixed
438
+
357
439
  - Limit ts-loader to 3.5.0 until webpack 4 support [#1308](https://github.com/rails/webpacker/pull/1308)
358
440
  - Custom env support [#1304](https://github.com/rails/webpacker/pull/1304)
359
441
 
@@ -387,7 +469,6 @@ And, bunch of bug fixes [See changes](https://github.com/rails/webpacker/compare
387
469
 
388
470
  - Revert file loader [#1196](https://github.com/rails/webpacker/pull/1196)
389
471
 
390
-
391
472
  ## [3.2.0] - 2017-12-16
392
473
 
393
474
  ### To upgrade:
@@ -417,11 +498,11 @@ into your `config/webpack/loaders/`
417
498
  directory and add it to webpack build from `config/webpack/environment.js`
418
499
 
419
500
  ```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')
501
+ const erb = require('./loaders/erb')
502
+ const elm = require('./loaders/elm')
503
+ const typescript = require('./loaders/typescript')
504
+ const vue = require('./loaders/vue')
505
+ const coffee = require('./loaders/coffee')
425
506
 
426
507
  environment.loaders.append('coffee', coffee)
427
508
  environment.loaders.append('vue', vue)
@@ -444,19 +525,16 @@ plugins:
444
525
 
445
526
  - `postcss-import` in place of `postcss-smart-import`
446
527
 
447
-
448
528
  ### Removed (npm module)
449
529
 
450
530
  - `postcss-smart-import`, `coffee-loader`, `url-loader`, `rails-erb-loader` as dependencies
451
531
 
452
- - `publicPath` from file loader [#1107](https://github.com/rails/webpacker/pull/1107)
453
-
532
+ - `publicPath` from file loader [#1107](https://github.com/rails/webpacker/pull/1107)
454
533
 
455
534
  ### Fixed (npm module)
456
535
 
457
536
  - Return native array type for `ConfigList` [#1098](https://github.com/rails/webpacker/pull/1098)
458
537
 
459
-
460
538
  ### Added (Gem)
461
539
 
462
540
  - New `asset_pack_url` helper [#1102](https://github.com/rails/webpacker/pull/1102)
@@ -470,17 +548,14 @@ bundle exec rails webpacker:install:coffee
470
548
 
471
549
  - Resolved paths from webpacker.yml to compiler watched list
472
550
 
473
-
474
551
  ## [3.1.1] - 2017-12-11
475
552
 
476
553
  ### Fixed
477
554
 
478
555
  - Include default webpacker.yml config inside npm package
479
556
 
480
-
481
557
  ## [3.1.0] - 2017-12-11
482
558
 
483
-
484
559
  ### Added (npm module)
485
560
 
486
561
  - Expose base config from environment
@@ -490,7 +565,8 @@ environment.config.set('resolve.extensions', ['.foo', '.bar'])
490
565
  environment.config.set('output.filename', '[name].js')
491
566
  environment.config.delete('output.chunkFilename')
492
567
  environment.config.get('resolve')
493
- environment.config.merge({ output: {
568
+ environment.config.merge({
569
+ output: {
494
570
  filename: '[name].js'
495
571
  }
496
572
  })
@@ -499,7 +575,7 @@ environment.config.merge({ output: {
499
575
  - Expose new API's for loaders and plugins to insert at position
500
576
 
501
577
  ```js
502
- const jsonLoader = {
578
+ const jsonLoader = {
503
579
  test: /\.json$/,
504
580
  exclude: /node_modules/,
505
581
  loader: 'json-loader'
@@ -507,8 +583,8 @@ const jsonLoader = {
507
583
 
508
584
  environment.loaders.append('json', jsonLoader)
509
585
  environment.loaders.prepend('json', jsonLoader)
510
- environment.loaders.insert('json', jsonLoader, { after: 'style' } )
511
- environment.loaders.insert('json', jsonLoader, { before: 'babel' } )
586
+ environment.loaders.insert('json', jsonLoader, { after: 'style' })
587
+ environment.loaders.insert('json', jsonLoader, { before: 'babel' })
512
588
 
513
589
  // Update a plugin
514
590
  const manifestPlugin = environment.plugins.get('Manifest')
@@ -516,10 +592,14 @@ manifestPlugin.opts.writeToFileEmit = false
516
592
 
517
593
  // Update coffee loader to use coffeescript 2
518
594
  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' })
595
+ environment.loaders.insert(
596
+ 'coffee',
597
+ {
598
+ test: /\.coffee(\.erb)?$/,
599
+ use: babelLoader.use.concat(['coffee-loader'])
600
+ },
601
+ { before: 'json' }
602
+ )
523
603
  ```
524
604
 
525
605
  - Expose `resolve.modules` paths like loaders and plugins
@@ -531,8 +611,8 @@ environment.resolvedModules.append('vendor', 'vendor')
531
611
  - Enable sourcemaps in `style` and `css` loader
532
612
 
533
613
  - 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.
614
+ `css` loader, which resolves `.css` files and `sass` loader resolves `.scss` and `.sass`
615
+ files.
536
616
 
537
617
  ```js
538
618
  // Enable css modules with sass loader
@@ -568,7 +648,6 @@ dev_server:
568
648
 
569
649
  - Add url loader to process and embed smaller static files
570
650
 
571
-
572
651
  ### Removed
573
652
 
574
653
  - resolve url loader [#1042](https://github.com/rails/webpacker/issues/1042)
@@ -585,8 +664,7 @@ WEBPACKER_PRECOMPILE=false bundle exec rails assets:precompile
585
664
  - Use `WEBPACKER_ASSET_HOST` instead of `ASSET_HOST` for CDN
586
665
 
587
666
  - Alias `webpacker:compile` task to `assets:precompile` if is not defined so it works
588
- without sprockets
589
-
667
+ without sprockets
590
668
 
591
669
  ## [3.0.2] - 2017-10-04
592
670
 
@@ -621,7 +699,7 @@ Webpacker.manifest.lookup!('foo.js')
621
699
  - Inline CLI args for dev server binstub, use env variables instead
622
700
 
623
701
  - Coffeescript as core dependency. You have to manually add coffeescript now, if you are using
624
- it in your app.
702
+ it in your app.
625
703
 
626
704
  ```bash
627
705
  yarn add coffeescript@1.12.7
@@ -653,8 +731,7 @@ yarn add coffeescript
653
731
  ### Removed
654
732
 
655
733
  - `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
-
734
+ 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
735
 
659
736
  ## [3.0.0] - 2017-08-30
660
737
 
@@ -663,9 +740,9 @@ live reload when manifest changes. If you have applied this workaround from [#72
663
740
  - `resolved_paths` option to allow adding additional paths webpack should lookup when resolving modules
664
741
 
665
742
  ```yml
666
- # config/webpacker.yml
667
- # Additional paths webpack should lookup modules
668
- resolved_paths: [] # empty by default
743
+ # config/webpacker.yml
744
+ # Additional paths webpack should lookup modules
745
+ resolved_paths: [] # empty by default
669
746
  ```
670
747
 
671
748
  - `Webpacker::Compiler.fresh?` and `Webpacker::Compiler.stale?` answer the question of whether compilation is needed.
@@ -718,8 +795,8 @@ live reload when manifest changes. If you have applied this workaround from [#72
718
795
  - Serve assets using `localhost` from dev server - [#424](https://github.com/rails/webpacker/issues/424)
719
796
 
720
797
  ```yml
721
- dev_server:
722
- host: localhost
798
+ dev_server:
799
+ host: localhost
723
800
  ```
724
801
 
725
802
  - 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 +806,21 @@ live reload when manifest changes. If you have applied this workaround from [#72
729
806
  - 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
807
 
731
808
  ```yaml
732
- default: &default
733
- cache_path: tmp/cache/webpacker
734
- test:
735
- compile: true
809
+ default: &default
810
+ cache_path: tmp/cache/webpacker
811
+ test:
812
+ compile: true
736
813
 
737
- development:
738
- compile: true
814
+ development:
815
+ compile: true
739
816
 
740
- production:
741
- compile: false
817
+ production:
818
+ compile: false
742
819
  ```
743
820
 
744
821
  - 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 -
822
+ only triggers if files are changed under tracked paths.
823
+ Following paths are watched by default -
747
824
 
748
825
  ```rb
749
826
  ["app/javascript/**/*", "yarn.lock", "package.json", "config/webpack/**/*"]
@@ -759,6 +836,7 @@ Following paths are watched by default -
759
836
  ## [2.0] - 2017-05-24
760
837
 
761
838
  ### Fixed
839
+
762
840
  - Update `.babelrc` to fix compilation issues - [#306](https://github.com/rails/webpacker/issues/306)
763
841
 
764
842
  - Duplicated asset hosts - [#320](https://github.com/rails/webpacker/issues/320), [#397](https://github.com/rails/webpacker/pull/397)
@@ -771,24 +849,28 @@ Following paths are watched by default -
771
849
 
772
850
  - ARGV support for `webpack-dev-server` - [#286](https://github.com/rails/webpacker/issues/286)
773
851
 
774
-
775
852
  ### Added
853
+
776
854
  - [Elm](http://elm-lang.org) support. You can now add Elm support via the following methods:
855
+
777
856
  - New app: `rails new <app> --webpack=elm`
778
857
  - Within an existing app: `rails webpacker:install:elm`
779
858
 
780
859
  - 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
860
 
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
- ```
861
+ Before (compile to `public/packs`):
862
+
863
+ ```yaml
864
+ source_entry_path: packs
865
+ public_output_path: packs
866
+ ```
867
+
868
+ After (compile to `public/sweet/js`):
869
+
870
+ ```yaml
871
+ source_entry_path: packs
872
+ public_output_path: sweet/js
873
+ ```
792
874
 
793
875
  - `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
876
 
@@ -797,26 +879,29 @@ Following paths are watched by default -
797
879
  ```json
798
880
  {
799
881
  "presets": [
800
- ["env", {
801
- "modules": false,
802
- "targets": {
803
- "browsers": "> 1%",
804
- "uglify": true
805
- },
806
- "useBuiltIns": true
807
- }]
882
+ [
883
+ "env",
884
+ {
885
+ "modules": false,
886
+ "targets": {
887
+ "browsers": "> 1%",
888
+ "uglify": true
889
+ },
890
+ "useBuiltIns": true
891
+ }
892
+ ]
808
893
  ],
809
894
 
810
895
  "plugins": [
811
896
  "syntax-dynamic-import",
812
- "transform-class-properties", { "spec": true }
897
+ "transform-class-properties",
898
+ { "spec": true }
813
899
  ]
814
900
  }
815
901
  ```
816
902
 
817
903
  - Source-map support for production bundle
818
904
 
819
-
820
905
  #### Breaking Change
821
906
 
822
907
  - 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 +916,16 @@ Following paths are watched by default -
831
916
  rm config/webpack/development.server.js
832
917
  ```
833
918
 
834
- __Warning__: For now you also have to add a pattern in `.gitignore` by hand.
919
+ **Warning**: For now you also have to add a pattern in `.gitignore` by hand.
920
+
835
921
  ```diff
836
922
  /public/packs
837
923
  +/public/packs-test
838
924
  /node_modules
839
- ```
925
+ ```
840
926
 
841
927
  ## [1.2] - 2017-04-27
928
+
842
929
  Some of the changes made requires you to run below commands to install new changes.
843
930
 
844
931
  ```
@@ -846,13 +933,14 @@ bundle update webpacker
846
933
  bundle exec rails webpacker:install
847
934
  ```
848
935
 
849
-
850
936
  ### Fixed
937
+
851
938
  - Support Spring - [#205](https://github.com/rails/webpacker/issues/205)
852
939
 
853
940
  ```ruby
854
941
  Spring.after_fork { Webpacker.bootstrap } if defined?(Spring)
855
942
  ```
943
+
856
944
  - Check node version and yarn before installing webpacker - [#217](https://github.com/rails/webpacker/issues/217)
857
945
 
858
946
  - Include webpacker helper to views - [#172](https://github.com/rails/webpacker/issues/172)
@@ -865,27 +953,28 @@ bundle exec rails webpacker:install
865
953
 
866
954
  - Move babel presets and plugins to .babelrc - [#202](https://github.com/rails/webpacker/issues/202)
867
955
 
868
-
869
956
  ### Added
957
+
870
958
  - A changelog - [#211](https://github.com/rails/webpacker/issues/211)
871
959
  - Minimize CSS assets - [#218](https://github.com/rails/webpacker/issues/218)
872
960
  - Pack namespacing support - [#201](https://github.com/rails/webpacker/pull/201)
873
961
 
874
962
  For example:
963
+
875
964
  ```
876
965
  app/javascript/packs/admin/hello_vue.js
877
966
  app/javascript/packs/admin/hello.vue
878
967
  app/javascript/packs/hello_vue.js
879
968
  app/javascript/packs/hello.vue
880
969
  ```
970
+
881
971
  - Add tree-shaking support - [#250](https://github.com/rails/webpacker/pull/250)
882
972
  - Add initial test case by @kimquy [#259](https://github.com/rails/webpacker/pull/259)
883
973
  - Compile assets before test:controllers and test:system
884
974
 
885
-
886
975
  ### Removed
887
- - Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)
888
976
 
977
+ - Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)
889
978
 
890
979
  ## [1.1] - 2017-03-24
891
980
 
@@ -900,10 +989,10 @@ bundle exec rails webpacker:install:[react, angular, vue]
900
989
  ```
901
990
 
902
991
  ### Added (breaking changes)
992
+
903
993
  - Static assets support - [#153](https://github.com/rails/webpacker/pull/153)
904
994
  - Advanced webpack configuration - [#153](https://github.com/rails/webpacker/pull/153)
905
995
 
906
-
907
996
  ### Removed
908
997
 
909
998
  ```rb