webpacker 4.0.2 → 5.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) 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 +58 -0
  7. data/.gitignore +1 -0
  8. data/.node-version +1 -1
  9. data/.rubocop.yml +115 -14
  10. data/.travis.yml +16 -18
  11. data/CHANGELOG.md +329 -130
  12. data/Gemfile +1 -1
  13. data/Gemfile.lock +127 -105
  14. data/README.md +84 -217
  15. data/docs/assets.md +20 -10
  16. data/docs/css.md +126 -7
  17. data/docs/deployment.md +55 -10
  18. data/docs/docker.md +33 -14
  19. data/docs/engines.md +60 -2
  20. data/docs/env.md +0 -2
  21. data/docs/es6.md +24 -5
  22. data/docs/integrations.md +220 -0
  23. data/docs/target.md +22 -0
  24. data/docs/testing.md +2 -3
  25. data/docs/troubleshooting.md +46 -7
  26. data/docs/typescript.md +93 -26
  27. data/docs/v4-upgrade.md +12 -2
  28. data/docs/webpack-dev-server.md +2 -2
  29. data/docs/webpack.md +21 -7
  30. data/gemfiles/Gemfile-rails-edge +2 -3
  31. data/gemfiles/Gemfile-rails.5.2.x +1 -2
  32. data/gemfiles/Gemfile-rails.6.0.x +9 -0
  33. data/lib/install/bin/webpack +0 -1
  34. data/lib/install/bin/webpack-dev-server +0 -1
  35. data/lib/install/coffee.rb +1 -1
  36. data/lib/install/config/babel.config.js +24 -12
  37. data/lib/install/config/webpacker.yml +3 -6
  38. data/lib/install/elm.rb +3 -3
  39. data/lib/install/erb.rb +2 -2
  40. data/lib/install/examples/angular/hello_angular/polyfills.ts +2 -2
  41. data/lib/install/examples/react/babel.config.js +31 -15
  42. data/lib/install/examples/react/tsconfig.json +2 -1
  43. data/lib/install/examples/svelte/app.svelte +11 -0
  44. data/lib/install/examples/svelte/hello_svelte.js +20 -0
  45. data/lib/install/examples/typescript/tsconfig.json +2 -1
  46. data/lib/install/examples/vue/hello_vue.js +2 -3
  47. data/lib/install/loaders/elm.js +9 -6
  48. data/lib/install/loaders/svelte.js +9 -0
  49. data/lib/install/svelte.rb +29 -0
  50. data/lib/install/template.rb +12 -4
  51. data/lib/install/typescript.rb +6 -13
  52. data/lib/install/vue.rb +1 -1
  53. data/lib/tasks/installers.rake +1 -0
  54. data/lib/tasks/webpacker/check_node.rake +15 -8
  55. data/lib/tasks/webpacker/check_yarn.rake +16 -10
  56. data/lib/tasks/webpacker/clean.rake +25 -0
  57. data/lib/tasks/webpacker/clobber.rake +8 -4
  58. data/lib/tasks/webpacker/compile.rake +10 -15
  59. data/lib/tasks/webpacker/yarn_install.rake +11 -1
  60. data/lib/tasks/webpacker.rake +2 -0
  61. data/lib/webpacker/commands.rb +53 -1
  62. data/lib/webpacker/compiler.rb +24 -9
  63. data/lib/webpacker/configuration.rb +36 -13
  64. data/lib/webpacker/dev_server.rb +1 -1
  65. data/lib/webpacker/dev_server_proxy.rb +5 -9
  66. data/lib/webpacker/dev_server_runner.rb +10 -4
  67. data/lib/webpacker/env.rb +6 -2
  68. data/lib/webpacker/helper.rb +71 -26
  69. data/lib/webpacker/manifest.rb +4 -4
  70. data/lib/webpacker/railtie.rb +6 -43
  71. data/lib/webpacker/runner.rb +1 -0
  72. data/lib/webpacker/version.rb +1 -1
  73. data/lib/webpacker/webpack_runner.rb +6 -0
  74. data/lib/webpacker.rb +9 -1
  75. data/package/__tests__/config.js +12 -24
  76. data/package/__tests__/dev_server.js +2 -0
  77. data/package/__tests__/development.js +14 -1
  78. data/package/config.js +6 -11
  79. data/package/configPath.js +3 -0
  80. data/package/config_types/config_list.js +3 -3
  81. data/package/config_types/config_object.js +1 -1
  82. data/package/dev_server.js +1 -1
  83. data/package/env.js +1 -2
  84. data/package/environments/__tests__/base.js +30 -3
  85. data/package/environments/base.js +20 -10
  86. data/package/environments/development.js +39 -37
  87. data/package/environments/production.js +12 -2
  88. data/package/rules/babel.js +12 -5
  89. data/package/rules/file.js +3 -2
  90. data/package/rules/node_modules.js +3 -4
  91. data/package/rules/sass.js +11 -2
  92. data/package/utils/__tests__/get_style_rule.js +9 -0
  93. data/package/utils/deep_merge.js +5 -5
  94. data/package/utils/get_style_rule.js +7 -12
  95. data/package/utils/helpers.js +10 -10
  96. data/package.json +43 -42
  97. data/test/command_test.rb +6 -0
  98. data/test/compiler_test.rb +10 -6
  99. data/test/configuration_test.rb +40 -30
  100. data/test/dev_server_runner_test.rb +1 -1
  101. data/test/dev_server_test.rb +22 -0
  102. data/test/helper_test.rb +58 -9
  103. data/test/manifest_test.rb +37 -6
  104. data/test/rake_tasks_test.rb +17 -0
  105. data/test/test_app/app/javascript/packs/multi_entry.css +4 -0
  106. data/test/test_app/app/javascript/packs/multi_entry.js +4 -0
  107. data/test/test_app/bin/webpack +0 -1
  108. data/test/test_app/bin/webpack-dev-server +0 -1
  109. data/test/test_app/config/application.rb +0 -1
  110. data/test/test_app/config/webpacker.yml +8 -1
  111. data/test/test_app/public/packs/manifest.json +4 -0
  112. data/test/webpack_runner_test.rb +1 -1
  113. data/webpacker.gemspec +7 -4
  114. data/yarn.lock +4552 -4077
  115. metadata +73 -19
  116. data/gemfiles/Gemfile-rails.4.2.x +0 -10
  117. data/gemfiles/Gemfile-rails.5.0.x +0 -10
  118. data/gemfiles/Gemfile-rails.5.1.x +0 -10
  119. data/lib/install/loaders/typescript.js +0 -11
data/CHANGELOG.md CHANGED
@@ -1,5 +1,142 @@
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.2]](https://github.com/rails/webpacker/compare/v5.4.0...v5.4.1) - 2021-08-20
6
+
7
+ - Fix babel warning about private-methods in @babel/plugin-proposal-private-property-in-object as well.
8
+
9
+ ## [[5.4.1]](https://github.com/rails/webpacker/compare/v5.4.0...v5.4.1) - 2021-08-20
10
+
11
+ - Update all dependencies within the same major version (#3120)
12
+
13
+ - Fix babel warning about private-methods (#3016)
14
+
15
+ ## [[5.4.0]](https://github.com/rails/webpacker/compare/v5.3.0...v5.4.0) - 2021-05-18
16
+
17
+ - Fix compatibility with Psych 4
18
+
19
+ ## [[5.3.0]](https://github.com/rails/webpacker/compare/v5.2.1...v5.3.0) - 2021-04-27
20
+
21
+ - Adds experimental Yarn 2 support. Note you must manually set `nodeLinker: node-modules` in your `.yarnrc.yml`.
22
+
23
+ - Keep backups, even when they're old [#2912](https://github.com/rails/webpacker/pull/2912)
24
+
25
+ ## [[5.2.2]](https://github.com/rails/webpacker/compare/v5.2.1...v5.2.2) - 2021-04-27
26
+
27
+ - Bump deps and remove node-sass [#2997](https://github.com/rails/webpacker/pull/2997).
28
+
29
+ ## [[5.2.1]](https://github.com/rails/webpacker/compare/v5.2.0...v5.2.1) - 2020-08-17
30
+
31
+ - Revert [#1311](https://github.com/rails/webpacker/pull/1311).
32
+
33
+ ## [[5.2.0]](https://github.com/rails/webpacker/compare/v5.1.1...v5.2.0) - 2020-08-16
34
+
35
+ - Bump dependencies and fixes. See [diff](https://github.com/rails/webpacker/compare/v5.1.1...5-x-stable) for changes.
36
+
37
+ ## [[5.1.1]](https://github.com/rails/webpacker/compare/v5.1.0...v5.1.1) - 2020-04-20
38
+
39
+ - 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)
40
+
41
+ ## [[5.1.0]](https://github.com/rails/webpacker/compare/v5.0.1...v5.1.0) - 2020-04-19
42
+
43
+ - Remove yarn integrity check [#2518](https://github.com/rails/webpacker/pull/2518)
44
+ - Switch from ts-loader to babel-loader [#2449](https://github.com/rails/webpacker/pull/2449)
45
+ 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
46
+ - Resolve multi-word snakecase WEBPACKER_DEV_SERVER env values [#2528](https://github.com/rails/webpacker/pull/2528)
47
+
48
+ ## [[5.0.1]](https://github.com/rails/webpacker/compare/v5.0.0...v5.0.1) - 2020-03-22
49
+
50
+ - Upgrade deps and fix sass loader config options bug [#2508](https://github.com/rails/webpacker/pull/2508)
51
+
52
+ ## [[5.0.0]](https://github.com/rails/webpacker/compare/v4.2.2...v5.0.0) - 2020-03-22
53
+
54
+ - Bump minimum node version [#2428](https://github.com/rails/webpacker/pull/2428)
55
+ - Bump minimum ruby/rails version [#2415](https://github.com/rails/webpacker/pull/2415)
56
+ - Add support for multiple files per entry [#2476](https://github.com/rails/webpacker/pull/2476)
57
+
58
+ ```js
59
+ entry: {
60
+ home: ['./home.js', './home.scss'],
61
+ account: ['./account.js', './account.scss']
62
+ }
63
+ ```
64
+
65
+ You can now have two entry files with same names inside packs folder, `home.scss` and `home.js`
66
+
67
+ And, other minor fixes, please see a list of changes [here](https://github.com/rails/webpacker/compare/v4.2.2...v5.0.0)
68
+
69
+ ## [[4.2.2]](https://github.com/rails/webpacker/compare/v4.2.1...v4.2.2) - 2019-12-09
70
+
71
+ - Fixed issue with webpack clean task for nested assets [#2391](https://github.com/rails/webpacker/pull/2391)
72
+
73
+ ## [[4.2.1]](https://github.com/rails/webpacker/compare/v4.2.0...v4.2.1) - 2019-12-09
74
+
75
+ - Fixed issue with webpack clean task [#2389](https://github.com/rails/webpacker/pull/2389)
76
+
77
+ ## [[4.2.0]](https://github.com/rails/webpacker/compare/v4.1.0...v4.2.0) - 2019-11-12
78
+
79
+ - Fixed installer bug [#2366](https://github.com/rails/webpacker/pull/2366)
80
+
81
+ ## [[4.1.0]](https://github.com/rails/webpacker/compare/v4.0.7...v4.1.0) - 2019-11-12
82
+
83
+ - Added favicon_pack_tag to generate favicon links [#2281](https://github.com/rails/webpacker/pull/2281)
84
+ - Add support for Brotli compression [#2273](https://github.com/rails/webpacker/pull/2273)
85
+ - Support .(sass|scss).erb [#2259](https://github.com/rails/webpacker/pull/2259)
86
+ - Elm: Enable production optimizations when compiling in production [#2234](https://github.com/rails/webpacker/pull/2234)
87
+ - fixes webpacker:clean erroring because of nested hashes [#2318](https://github.com/rails/webpacker/pull/2318)
88
+ - Revert of production env enforcement [#2341](https://github.com/rails/webpacker/pull/2341)
89
+ - Add a preload_pack_asset helper [#2124](https://github.com/rails/webpacker/pull/2124)
90
+ - Record the compilation digest even on webpack error [#2117](https://github.com/rails/webpacker/pull/2117)
91
+ - See more changes [here](https://github.com/rails/webpacker/compare/v4.0.7...v4.1.0)
92
+
93
+ ## [[4.0.7]](https://github.com/rails/webpacker/compare/v4.0.6...v4.0.7) - 2019-06-03
94
+
95
+ - 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)
96
+ - 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):
97
+ - `@babel/preset-env` should contain `corejs: 3`
98
+ - `@babel/plugin-transform-runtime` should contain `corejs: false`
99
+ - Removed unneeded runtime `@babel/runtime-corejs3`
100
+
101
+ ## [[4.0.6]](https://github.com/rails/webpacker/compare/v4.0.5...v4.0.6) - 2019-05-30
102
+
103
+ - Webpack should not be transpiled [#2111](https://github.com/rails/webpacker/pull/2111)
104
+
105
+ ## [[4.0.5]](https://github.com/rails/webpacker/compare/v4.0.4...v4.0.5) - 2019-05-30
106
+
107
+ - Don't let babel & core-js transpile each other [#2110](https://github.com/rails/webpacker/pull/2110)
108
+
109
+ ## [[4.0.4]](https://github.com/rails/webpacker/compare/v4.0.3...v4.0.4) - 2019-05-28
110
+
111
+ - Remove bundler version constraint
112
+
113
+ ## [[4.0.3]](https://github.com/rails/webpacker/compare/v4.0.2...v4.0.3) - 2019-05-28
114
+
115
+ Please see the diff
116
+
117
+ ##### Breaking changes (for pre-existing apps)
118
+
119
+ - [`@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)
120
+
121
+ In each of your `/packs/*.js` files, change this:
122
+
123
+ ```js
124
+ import '@babel/polyfill'
125
+ ```
126
+
127
+ to this:
128
+
129
+ ```js
130
+ import 'core-js/stable'
131
+ import 'regenerator-runtime/runtime'
132
+ ```
133
+
134
+ Don't forget to install those dependencies directly!
135
+
136
+ ```sh
137
+ yarn add core-js regenerator-runtime
138
+ ```
139
+
3
140
  ## [4.0.2] - 2019-03-06
4
141
 
5
142
  - Bump the version on npm
@@ -10,12 +147,10 @@
10
147
 
11
148
  - Pre-release version installer
12
149
 
13
-
14
150
  ## [4.0.0] - 2019-03-04
15
151
 
16
152
  No changes in this release. See RC releases for changes.
17
153
 
18
-
19
154
  ## [4.0.0.rc.8] - 2019-03-03
20
155
 
21
156
  ### Fixed
@@ -39,9 +174,9 @@ module.exports = environment.toWebpackConfig()
39
174
  - Reintroduced `context` to the file loader. Reverting the simpler paths change
40
175
 
41
176
  - Updated file loader to have filename based on the path. This change
42
- keeps the old behaviour intact i.e. let people use namespaces for media
43
- inside `app/javascript` and also include media outside of `app/javascript`
44
- with simpler paths, for example from `node_modules` or `app/assets`
177
+ keeps the old behaviour intact i.e. let people use namespaces for media
178
+ inside `app/javascript` and also include media outside of `app/javascript`
179
+ with simpler paths, for example from `node_modules` or `app/assets`
45
180
 
46
181
  ```bash
47
182
  # Files inside app/javascript (i.e. packs source path)
@@ -59,14 +194,12 @@ media/webfonts/fa-brands-400-4b115e11.woff2
59
194
  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
60
195
  `app/javascript`
61
196
 
62
-
63
197
  ## [4.0.0.rc.7] - 2019-01-25
64
198
 
65
199
  ### Fixed
66
200
 
67
201
  - Webpacker builds test app assets [#1908](https://github.com/rails/webpacker/issues/1908)
68
202
 
69
-
70
203
  ## [4.0.0.rc.6] - 2019-01-25
71
204
 
72
205
  ### Fixed
@@ -112,12 +245,12 @@ fileLoader.use[0].options.context = join(config.source_path) // optional if you
112
245
 
113
246
  - Gems and node dependencies
114
247
 
115
-
116
248
  ## [4.0.0.rc.4] - 2019-01-21
117
249
 
118
250
  ### Added
119
- - `stylesheet_packs_with_chunks_tag` helper, similar to javascript helper but for
120
- loading stylesheets chunks.
251
+
252
+ - `stylesheet_packs_with_chunks_tag` helper, similar to javascript helper but for
253
+ loading stylesheets chunks.
121
254
 
122
255
  ```erb
123
256
  <%= stylesheet_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
@@ -138,15 +271,15 @@ helper otherwise you will get duplicated chunks on the page.
138
271
  # <%= stylesheet_packs_with_chunks_tag 'map' %>
139
272
  ```
140
273
 
141
-
142
274
  ## [4.0.0.rc.3] - 2019-01-17
143
275
 
144
276
  ### Fixed
145
- - Issue with javascript_pack_tag asset duplication [#1898](https://github.com/rails/webpacker/pull/1898)
146
277
 
278
+ - Issue with javascript_pack_tag asset duplication [#1898](https://github.com/rails/webpacker/pull/1898)
147
279
 
148
280
  ### Added
149
- - `javascript_packs_with_chunks_tag` helper, which creates html tags
281
+
282
+ - `javascript_packs_with_chunks_tag` helper, which creates html tags
150
283
  for a pack and all the dependent chunks, when using splitchunks.
151
284
 
152
285
  ```erb
@@ -174,68 +307,77 @@ helper otherwise you will get duplicated chunks on the page.
174
307
  ## [4.0.0.rc.2] - 2018-12-15
175
308
 
176
309
  ### Fixed
177
- - Disable integrity hash generation [#1835](https://github.com/rails/webpacker/issues/1835)
178
310
 
311
+ - Disable integrity hash generation [#1835](https://github.com/rails/webpacker/issues/1835)
179
312
 
180
313
  ## [4.0.0.rc.1] - 2018-12-14
181
314
 
182
315
  ### Breaking changes
183
316
 
184
- - Order of rules changed so you might have to change append to prepend,
317
+ - Order of rules changed so you might have to change append to prepend,
185
318
  depending on how you want to process packs [#1823](https://github.com/rails/webpacker/pull/1823)
186
- ```js
187
- environment.loaders.prepend()
188
- ```
189
- - Separate CSS extraction from build environment [#1625](https://github.com/rails/webpacker/pull/1625)
190
- ```yml
191
- # Extract and emit a css file
192
- extract_css: true
193
- ```
194
- - Separate rule to compile node modules
319
+
320
+ ```js
321
+ environment.loaders.prepend()
322
+ ```
323
+
324
+ - Separate CSS extraction from build environment [#1625](https://github.com/rails/webpacker/pull/1625)
325
+
326
+ ```yml
327
+ # Extract and emit a css file
328
+ extract_css: true
329
+ ```
330
+
331
+ - Separate rule to compile node modules
195
332
  (fixes cases where ES6 libraries were included in the app code) [#1823](https://github.com/rails/webpacker/pull/1823).
196
333
 
197
- 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).
334
+ 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).
198
335
 
199
- [`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.
336
+ [`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.
200
337
 
201
- To keep previous behavior, remove `nodeModules` loader specifying `environment.loaders.delete('nodeModules');` in your `config/webpack/environment.js` file.
338
+ To keep previous behavior, remove `nodeModules` loader specifying `environment.loaders.delete('nodeModules');` in your `config/webpack/environment.js` file.
202
339
 
203
- - File loader extensions API [#1823](https://github.com/rails/webpacker/pull/1823)
204
- ```yml
205
- # webpacker.yml
206
- static_assets_extensions:
207
- - .pdf
208
- # etc..
209
- ```
340
+ - File loader extensions API [#1823](https://github.com/rails/webpacker/pull/1823)
341
+
342
+ ```yml
343
+ # webpacker.yml
344
+ static_assets_extensions:
345
+ - .pdf
346
+ # etc..
347
+ ```
210
348
 
211
349
  ### Added
212
350
 
213
- - Move `.babelrc` and `.postcssrc` to `.js` variant [#1822](https://github.com/rails/webpacker/pull/1822)
214
- - Use postcss safe parser when optimising css assets [#1822](https://github.com/rails/webpacker/pull/1822)
215
- - Add split chunks api (undocumented)
216
- ```js
217
- const { environment } = require('@rails/webpacker')
218
- // Enable with default config
219
- environment.splitChunks()
220
- // Configure via a callback
221
- environment.splitChunks((config) => Object.assign({}, config, { optimization: { splitChunks: false }}))
222
- ```
223
- - Allow changing static file extensions using webpacker.yml (undocumented)
351
+ - Move `.babelrc` and `.postcssrc` to `.js` variant [#1822](https://github.com/rails/webpacker/pull/1822)
352
+ - Use postcss safe parser when optimising css assets [#1822](https://github.com/rails/webpacker/pull/1822)
353
+ - Add split chunks api (undocumented)
354
+
355
+ ```js
356
+ const { environment } = require('@rails/webpacker')
357
+ // Enable with default config
358
+ environment.splitChunks()
359
+ // Configure via a callback
360
+ environment.splitChunks((config) =>
361
+ Object.assign({}, config, { optimization: { splitChunks: false } })
362
+ )
363
+ ```
364
+
365
+ - Allow changing static file extensions using webpacker.yml (undocumented)
224
366
 
225
367
  ## [4.0.0-pre.3] - 2018-10-01
226
368
 
227
369
  ### Added
228
370
 
229
- - Move supported browsers configuration to [.browserslistrc](https://github.com/browserslist/browserslist#queries)
371
+ - Move supported browsers configuration to [.browserslistrc](https://github.com/browserslist/browserslist#queries)
230
372
 
231
373
  ### Breaking changes
232
374
 
233
- - postcss-next is replaced with postcss-preset-env
234
- - babel@7
375
+ - postcss-next is replaced with postcss-preset-env
376
+ - babel@7
235
377
 
236
378
  ### Fixed
237
379
 
238
- - Bring back test env [#1563](https://github.com/rails/webpacker/pull/1563)
380
+ - Bring back test env [#1563](https://github.com/rails/webpacker/pull/1563)
239
381
 
240
382
  Please see a list of [commits](https://github.com/rails/webpacker/compare/2dd68f0273074aadb3f869c4c30369d5e4e3fea7...master)
241
383
 
@@ -245,36 +387,82 @@ Please see a list of [commits](https://github.com/rails/webpacker/compare/2dd68f
245
387
 
246
388
  - Webpack dev server version in installer
247
389
 
248
-
249
390
  ## [4.0.0-pre.1] - 2018-04-2
250
391
 
251
392
  Pre-release to try out webpack 4.0 support
252
393
 
253
394
  ### Added
254
- - Webpack 4.0 support [#1376](https://github.com/rails/webpacker/pull/1316)
395
+
396
+ - Webpack 4.0 support [#1376](https://github.com/rails/webpacker/pull/1316)
397
+
398
+ ### Fixed
399
+
400
+ - Remove compilation digest file if webpack command fails[#1398](https://github.com/rails/webpacker/issues/1398)
401
+
402
+ ## [3.6.0] - 2019-03-06
403
+
404
+ See changes: https://github.com/rails/webpacker/compare/88a253ed42966eb2d5c997435e9396881513bce1...3-x-stable
405
+
406
+ ## [3.5.5] - 2018-07-09
407
+
408
+ See changes: https://github.com/rails/webpacker/compare/e8b197e36c77181ca2e4765c620faea59dcd0351...3-x-stable
409
+
410
+ ### Added
411
+
412
+ - On CI, sort files & check modified w/ digest intead of mtime[#1522](https://github.com/rails/webpacker/pull/1522)
413
+
414
+ ## [3.5.3] - 2018-05-03
415
+
416
+ ### Fixed
417
+
418
+ - Relax Javascript package dependencies [#1466](https://github.com/rails/webpacker/pull/1466#issuecomment-386336605)
419
+
420
+ ## [3.5.2] - 2018-04-29
421
+
422
+ - Pin Javascript package to 3.5.x
423
+
424
+ ## [3.5.1] - 2018-04-29
425
+
426
+ - Upgraded gems and Javascript packages
427
+
428
+ ## [3.5.0] - 2018-04-29
255
429
 
256
430
  ### Fixed
257
- - Remove compilation digest file if webpack command fails[#1398](https://github.com/rails/webpacker/issues/1398)
258
431
 
432
+ - Remove compilation digest file if webpack command fails [#1399](https://github.com/rails/webpacker/pull/1399)
433
+ - Handle http dev_server setting properly in the proxy [#1420](https://github.com/rails/webpacker/pull/1420)
434
+ - Use correct protocol [#1425](https://github.com/rails/webpacker/pull/1425)
435
+
436
+ ### Added
437
+
438
+ - `image_pack_tag` helper [#1400](https://github.com/rails/webpacker/pull/1400)
439
+ - devserver proxy for custom environments [#1415](https://github.com/rails/webpacker/pull/1415)
440
+ - Rails webpacker:info task [#1416](https://github.com/rails/webpacker/pull/1416)
441
+ - Include `RAILS_RELATIVE_URL_ROOT` environment variable in publicPath [#1428](https://github.com/rails/webpacker/pull/1428)
442
+
443
+ Complete list of changes: [#1464](https://github.com/rails/webpacker/pull/1464)
259
444
 
260
- Please refer to [3-x-stable](https://github.com/rails/webpacker/tree/3-x-stable) branch
261
- for further releases and changelogs:
445
+ ## [3.4.3] - 2018-04-3
446
+
447
+ ### Fixed
448
+
449
+ - Lock webpacker version in installer [#1401](https://github.com/rails/webpacker/issues/1401)
262
450
 
263
451
  ## [3.4.1] - 2018-03-24
264
452
 
265
453
  ### Fixed
266
- - Yarn integrity check in development [#1374](https://github.com/rails/webpacker/issues/1374)
267
454
 
455
+ - Yarn integrity check in development [#1374](https://github.com/rails/webpacker/issues/1374)
268
456
 
269
457
  ## [3.4.0] - 2018-03-23
270
458
 
271
459
  **Please use 3.4.1 instead**
272
460
 
273
461
  ### Added
274
- - Support for custom Rails environments [#1359](https://github.com/rails/webpacker/pull/1359)
275
462
 
276
- *This could break the compilation if you set NODE_ENV to custom environment. Now, NODE_ENV only understands production or development mode*
463
+ - Support for custom Rails environments [#1359](https://github.com/rails/webpacker/pull/1359)
277
464
 
465
+ _This could break the compilation if you set NODE_ENV to custom environment. Now, NODE_ENV only understands production or development mode_
278
466
 
279
467
  ## [3.3.1] - 2018-03-12
280
468
 
@@ -297,6 +485,7 @@ for further releases and changelogs:
297
485
  ```
298
486
  bundle exec rails webpacker:binstubs
299
487
  ```
488
+
300
489
  - set function is now removed from plugins and loaders, please use `append` or `prepend`
301
490
 
302
491
  ```js
@@ -310,6 +499,7 @@ environment.loaders.append('json', {
310
499
  ```
311
500
 
312
501
  ### Fixed
502
+
313
503
  - Limit ts-loader to 3.5.0 until webpack 4 support [#1308](https://github.com/rails/webpacker/pull/1308)
314
504
  - Custom env support [#1304](https://github.com/rails/webpacker/pull/1304)
315
505
 
@@ -343,7 +533,6 @@ And, bunch of bug fixes [See changes](https://github.com/rails/webpacker/compare
343
533
 
344
534
  - Revert file loader [#1196](https://github.com/rails/webpacker/pull/1196)
345
535
 
346
-
347
536
  ## [3.2.0] - 2017-12-16
348
537
 
349
538
  ### To upgrade:
@@ -373,11 +562,11 @@ into your `config/webpack/loaders/`
373
562
  directory and add it to webpack build from `config/webpack/environment.js`
374
563
 
375
564
  ```js
376
- const erb = require('./loaders/erb')
377
- const elm = require('./loaders/elm')
378
- const typescript = require('./loaders/typescript')
379
- const vue = require('./loaders/vue')
380
- const coffee = require('./loaders/coffee')
565
+ const erb = require('./loaders/erb')
566
+ const elm = require('./loaders/elm')
567
+ const typescript = require('./loaders/typescript')
568
+ const vue = require('./loaders/vue')
569
+ const coffee = require('./loaders/coffee')
381
570
 
382
571
  environment.loaders.append('coffee', coffee)
383
572
  environment.loaders.append('vue', vue)
@@ -400,19 +589,16 @@ plugins:
400
589
 
401
590
  - `postcss-import` in place of `postcss-smart-import`
402
591
 
403
-
404
592
  ### Removed (npm module)
405
593
 
406
594
  - `postcss-smart-import`, `coffee-loader`, `url-loader`, `rails-erb-loader` as dependencies
407
595
 
408
- - `publicPath` from file loader [#1107](https://github.com/rails/webpacker/pull/1107)
409
-
596
+ - `publicPath` from file loader [#1107](https://github.com/rails/webpacker/pull/1107)
410
597
 
411
598
  ### Fixed (npm module)
412
599
 
413
600
  - Return native array type for `ConfigList` [#1098](https://github.com/rails/webpacker/pull/1098)
414
601
 
415
-
416
602
  ### Added (Gem)
417
603
 
418
604
  - New `asset_pack_url` helper [#1102](https://github.com/rails/webpacker/pull/1102)
@@ -426,17 +612,14 @@ bundle exec rails webpacker:install:coffee
426
612
 
427
613
  - Resolved paths from webpacker.yml to compiler watched list
428
614
 
429
-
430
615
  ## [3.1.1] - 2017-12-11
431
616
 
432
617
  ### Fixed
433
618
 
434
619
  - Include default webpacker.yml config inside npm package
435
620
 
436
-
437
621
  ## [3.1.0] - 2017-12-11
438
622
 
439
-
440
623
  ### Added (npm module)
441
624
 
442
625
  - Expose base config from environment
@@ -446,7 +629,8 @@ environment.config.set('resolve.extensions', ['.foo', '.bar'])
446
629
  environment.config.set('output.filename', '[name].js')
447
630
  environment.config.delete('output.chunkFilename')
448
631
  environment.config.get('resolve')
449
- environment.config.merge({ output: {
632
+ environment.config.merge({
633
+ output: {
450
634
  filename: '[name].js'
451
635
  }
452
636
  })
@@ -455,7 +639,7 @@ environment.config.merge({ output: {
455
639
  - Expose new API's for loaders and plugins to insert at position
456
640
 
457
641
  ```js
458
- const jsonLoader = {
642
+ const jsonLoader = {
459
643
  test: /\.json$/,
460
644
  exclude: /node_modules/,
461
645
  loader: 'json-loader'
@@ -463,8 +647,8 @@ const jsonLoader = {
463
647
 
464
648
  environment.loaders.append('json', jsonLoader)
465
649
  environment.loaders.prepend('json', jsonLoader)
466
- environment.loaders.insert('json', jsonLoader, { after: 'style' } )
467
- environment.loaders.insert('json', jsonLoader, { before: 'babel' } )
650
+ environment.loaders.insert('json', jsonLoader, { after: 'style' })
651
+ environment.loaders.insert('json', jsonLoader, { before: 'babel' })
468
652
 
469
653
  // Update a plugin
470
654
  const manifestPlugin = environment.plugins.get('Manifest')
@@ -472,10 +656,14 @@ manifestPlugin.opts.writeToFileEmit = false
472
656
 
473
657
  // Update coffee loader to use coffeescript 2
474
658
  const babelLoader = environment.loaders.get('babel')
475
- environment.loaders.insert('coffee', {
476
- test: /\.coffee(\.erb)?$/,
477
- use: babelLoader.use.concat(['coffee-loader'])
478
- }, { before: 'json' })
659
+ environment.loaders.insert(
660
+ 'coffee',
661
+ {
662
+ test: /\.coffee(\.erb)?$/,
663
+ use: babelLoader.use.concat(['coffee-loader'])
664
+ },
665
+ { before: 'json' }
666
+ )
479
667
  ```
480
668
 
481
669
  - Expose `resolve.modules` paths like loaders and plugins
@@ -487,13 +675,15 @@ environment.resolvedModules.append('vendor', 'vendor')
487
675
  - Enable sourcemaps in `style` and `css` loader
488
676
 
489
677
  - Separate `css` and `sass` loader for easier configuration. `style` loader is now
490
- `css` loader, which resolves `.css` files and `sass` loader resolves `.scss` and `.sass`
491
- files.
678
+ `css` loader, which resolves `.css` files and `sass` loader resolves `.scss` and `.sass`
679
+ files.
492
680
 
493
681
  ```js
494
682
  // Enable css modules with sass loader
495
683
  const sassLoader = environment.loaders.get('sass')
496
- const cssLoader = sassLoader.use.find(loader => loader.loader === 'css-loader')
684
+ const cssLoader = sassLoader.use.find(
685
+ (loader) => loader.loader === 'css-loader'
686
+ )
497
687
 
498
688
  cssLoader.options = Object.assign({}, cssLoader.options, {
499
689
  modules: true,
@@ -524,7 +714,6 @@ dev_server:
524
714
 
525
715
  - Add url loader to process and embed smaller static files
526
716
 
527
-
528
717
  ### Removed
529
718
 
530
719
  - resolve url loader [#1042](https://github.com/rails/webpacker/issues/1042)
@@ -541,8 +730,7 @@ WEBPACKER_PRECOMPILE=false bundle exec rails assets:precompile
541
730
  - Use `WEBPACKER_ASSET_HOST` instead of `ASSET_HOST` for CDN
542
731
 
543
732
  - Alias `webpacker:compile` task to `assets:precompile` if is not defined so it works
544
- without sprockets
545
-
733
+ without sprockets
546
734
 
547
735
  ## [3.0.2] - 2017-10-04
548
736
 
@@ -577,7 +765,7 @@ Webpacker.manifest.lookup!('foo.js')
577
765
  - Inline CLI args for dev server binstub, use env variables instead
578
766
 
579
767
  - Coffeescript as core dependency. You have to manually add coffeescript now, if you are using
580
- it in your app.
768
+ it in your app.
581
769
 
582
770
  ```bash
583
771
  yarn add coffeescript@1.12.7
@@ -609,8 +797,7 @@ yarn add coffeescript
609
797
  ### Removed
610
798
 
611
799
  - `watchContentBase` from devServer config so it doesn't unncessarily trigger
612
- 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.
613
-
800
+ 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.
614
801
 
615
802
  ## [3.0.0] - 2017-08-30
616
803
 
@@ -619,9 +806,9 @@ live reload when manifest changes. If you have applied this workaround from [#72
619
806
  - `resolved_paths` option to allow adding additional paths webpack should lookup when resolving modules
620
807
 
621
808
  ```yml
622
- # config/webpacker.yml
623
- # Additional paths webpack should lookup modules
624
- resolved_paths: [] # empty by default
809
+ # config/webpacker.yml
810
+ # Additional paths webpack should lookup modules
811
+ resolved_paths: [] # empty by default
625
812
  ```
626
813
 
627
814
  - `Webpacker::Compiler.fresh?` and `Webpacker::Compiler.stale?` answer the question of whether compilation is needed.
@@ -674,8 +861,8 @@ live reload when manifest changes. If you have applied this workaround from [#72
674
861
  - Serve assets using `localhost` from dev server - [#424](https://github.com/rails/webpacker/issues/424)
675
862
 
676
863
  ```yml
677
- dev_server:
678
- host: localhost
864
+ dev_server:
865
+ host: localhost
679
866
  ```
680
867
 
681
868
  - 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)
@@ -685,21 +872,21 @@ live reload when manifest changes. If you have applied this workaround from [#72
685
872
  - 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`:
686
873
 
687
874
  ```yaml
688
- default: &default
689
- cache_path: tmp/cache/webpacker
690
- test:
691
- compile: true
875
+ default: &default
876
+ cache_path: tmp/cache/webpacker
877
+ test:
878
+ compile: true
692
879
 
693
- development:
694
- compile: true
880
+ development:
881
+ compile: true
695
882
 
696
- production:
697
- compile: false
883
+ production:
884
+ compile: false
698
885
  ```
699
886
 
700
887
  - Make test compilation cacheable and configurable so that the lazy compilation
701
- only triggers if files are changed under tracked paths.
702
- Following paths are watched by default -
888
+ only triggers if files are changed under tracked paths.
889
+ Following paths are watched by default -
703
890
 
704
891
  ```rb
705
892
  ["app/javascript/**/*", "yarn.lock", "package.json", "config/webpack/**/*"]
@@ -715,6 +902,7 @@ Following paths are watched by default -
715
902
  ## [2.0] - 2017-05-24
716
903
 
717
904
  ### Fixed
905
+
718
906
  - Update `.babelrc` to fix compilation issues - [#306](https://github.com/rails/webpacker/issues/306)
719
907
 
720
908
  - Duplicated asset hosts - [#320](https://github.com/rails/webpacker/issues/320), [#397](https://github.com/rails/webpacker/pull/397)
@@ -727,24 +915,28 @@ Following paths are watched by default -
727
915
 
728
916
  - ARGV support for `webpack-dev-server` - [#286](https://github.com/rails/webpacker/issues/286)
729
917
 
730
-
731
918
  ### Added
919
+
732
920
  - [Elm](http://elm-lang.org) support. You can now add Elm support via the following methods:
921
+
733
922
  - New app: `rails new <app> --webpack=elm`
734
923
  - Within an existing app: `rails webpacker:install:elm`
735
924
 
736
925
  - 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)
737
926
 
738
- Before (compile to `public/packs`):
739
- ```yaml
740
- source_entry_path: packs
741
- public_output_path: packs
742
- ```
743
- After (compile to `public/sweet/js`):
744
- ```yaml
745
- source_entry_path: packs
746
- public_output_path: sweet/js
747
- ```
927
+ Before (compile to `public/packs`):
928
+
929
+ ```yaml
930
+ source_entry_path: packs
931
+ public_output_path: packs
932
+ ```
933
+
934
+ After (compile to `public/sweet/js`):
935
+
936
+ ```yaml
937
+ source_entry_path: packs
938
+ public_output_path: sweet/js
939
+ ```
748
940
 
749
941
  - `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)
750
942
 
@@ -753,26 +945,29 @@ Following paths are watched by default -
753
945
  ```json
754
946
  {
755
947
  "presets": [
756
- ["env", {
757
- "modules": false,
758
- "targets": {
759
- "browsers": "> 1%",
760
- "uglify": true
761
- },
762
- "useBuiltIns": true
763
- }]
948
+ [
949
+ "env",
950
+ {
951
+ "modules": false,
952
+ "targets": {
953
+ "browsers": "> 1%",
954
+ "uglify": true
955
+ },
956
+ "useBuiltIns": true
957
+ }
958
+ ]
764
959
  ],
765
960
 
766
961
  "plugins": [
767
962
  "syntax-dynamic-import",
768
- "transform-class-properties", { "spec": true }
963
+ "transform-class-properties",
964
+ { "spec": true }
769
965
  ]
770
966
  }
771
967
  ```
772
968
 
773
969
  - Source-map support for production bundle
774
970
 
775
-
776
971
  #### Breaking Change
777
972
 
778
973
  - 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.
@@ -787,14 +982,16 @@ Following paths are watched by default -
787
982
  rm config/webpack/development.server.js
788
983
  ```
789
984
 
790
- __Warning__: For now you also have to add a pattern in `.gitignore` by hand.
985
+ **Warning**: For now you also have to add a pattern in `.gitignore` by hand.
986
+
791
987
  ```diff
792
988
  /public/packs
793
989
  +/public/packs-test
794
990
  /node_modules
795
- ```
991
+ ```
796
992
 
797
993
  ## [1.2] - 2017-04-27
994
+
798
995
  Some of the changes made requires you to run below commands to install new changes.
799
996
 
800
997
  ```
@@ -802,13 +999,14 @@ bundle update webpacker
802
999
  bundle exec rails webpacker:install
803
1000
  ```
804
1001
 
805
-
806
1002
  ### Fixed
1003
+
807
1004
  - Support Spring - [#205](https://github.com/rails/webpacker/issues/205)
808
1005
 
809
1006
  ```ruby
810
1007
  Spring.after_fork { Webpacker.bootstrap } if defined?(Spring)
811
1008
  ```
1009
+
812
1010
  - Check node version and yarn before installing webpacker - [#217](https://github.com/rails/webpacker/issues/217)
813
1011
 
814
1012
  - Include webpacker helper to views - [#172](https://github.com/rails/webpacker/issues/172)
@@ -821,27 +1019,28 @@ bundle exec rails webpacker:install
821
1019
 
822
1020
  - Move babel presets and plugins to .babelrc - [#202](https://github.com/rails/webpacker/issues/202)
823
1021
 
824
-
825
1022
  ### Added
1023
+
826
1024
  - A changelog - [#211](https://github.com/rails/webpacker/issues/211)
827
1025
  - Minimize CSS assets - [#218](https://github.com/rails/webpacker/issues/218)
828
1026
  - Pack namespacing support - [#201](https://github.com/rails/webpacker/pull/201)
829
1027
 
830
1028
  For example:
1029
+
831
1030
  ```
832
1031
  app/javascript/packs/admin/hello_vue.js
833
1032
  app/javascript/packs/admin/hello.vue
834
1033
  app/javascript/packs/hello_vue.js
835
1034
  app/javascript/packs/hello.vue
836
1035
  ```
1036
+
837
1037
  - Add tree-shaking support - [#250](https://github.com/rails/webpacker/pull/250)
838
1038
  - Add initial test case by @kimquy [#259](https://github.com/rails/webpacker/pull/259)
839
1039
  - Compile assets before test:controllers and test:system
840
1040
 
841
-
842
1041
  ### Removed
843
- - Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)
844
1042
 
1043
+ - Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)
845
1044
 
846
1045
  ## [1.1] - 2017-03-24
847
1046
 
@@ -856,10 +1055,10 @@ bundle exec rails webpacker:install:[react, angular, vue]
856
1055
  ```
857
1056
 
858
1057
  ### Added (breaking changes)
1058
+
859
1059
  - Static assets support - [#153](https://github.com/rails/webpacker/pull/153)
860
1060
  - Advanced webpack configuration - [#153](https://github.com/rails/webpacker/pull/153)
861
1061
 
862
-
863
1062
  ### Removed
864
1063
 
865
1064
  ```rb