webpacker 4.0.6 → 4.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.node-version +1 -1
- data/.rubocop.yml +2 -1
- data/.travis.yml +7 -4
- data/CHANGELOG.md +233 -136
- data/Gemfile.lock +78 -59
- data/README.md +110 -3
- data/docs/css.md +12 -0
- data/docs/deployment.md +38 -9
- data/docs/docker.md +25 -6
- data/docs/engines.md +40 -3
- data/docs/es6.md +19 -1
- data/docs/troubleshooting.md +37 -9
- data/docs/typescript.md +8 -5
- data/docs/webpack-dev-server.md +1 -1
- data/docs/webpack.md +18 -3
- data/gemfiles/Gemfile-rails.6.0.x +9 -0
- data/lib/install/bin/webpack +0 -1
- data/lib/install/bin/webpack-dev-server +0 -1
- data/lib/install/coffee.rb +1 -1
- data/lib/install/config/babel.config.js +11 -11
- data/lib/install/config/webpacker.yml +2 -1
- data/lib/install/elm.rb +1 -1
- data/lib/install/erb.rb +2 -2
- data/lib/install/examples/angular/hello_angular/polyfills.ts +2 -2
- data/lib/install/examples/react/babel.config.js +18 -15
- data/lib/install/examples/svelte/app.svelte +11 -0
- data/lib/install/examples/svelte/hello_svelte.js +20 -0
- data/lib/install/loaders/elm.js +9 -6
- data/lib/install/loaders/svelte.js +9 -0
- data/lib/install/loaders/typescript.js +1 -1
- data/lib/install/svelte.rb +29 -0
- data/lib/install/template.rb +1 -1
- data/lib/install/typescript.rb +1 -1
- data/lib/install/vue.rb +1 -1
- data/lib/tasks/installers.rake +1 -0
- data/lib/tasks/webpacker.rake +2 -0
- data/lib/tasks/webpacker/clean.rake +19 -0
- data/lib/tasks/webpacker/compile.rake +2 -10
- data/lib/tasks/webpacker/yarn_install.rake +15 -0
- data/lib/webpacker.rb +9 -1
- data/lib/webpacker/commands.rb +29 -1
- data/lib/webpacker/compiler.rb +15 -8
- data/lib/webpacker/configuration.rb +9 -1
- data/lib/webpacker/dev_server.rb +1 -1
- data/lib/webpacker/dev_server_proxy.rb +2 -8
- data/lib/webpacker/env.rb +1 -1
- data/lib/webpacker/helper.rb +39 -13
- data/lib/webpacker/railtie.rb +6 -0
- data/lib/webpacker/version.rb +1 -1
- data/package.json +36 -37
- data/package/__tests__/config.js +0 -23
- data/package/config.js +2 -10
- data/package/config_types/config_list.js +3 -3
- data/package/config_types/config_object.js +1 -1
- data/package/environments/base.js +2 -2
- data/package/environments/development.js +1 -1
- data/package/environments/production.js +12 -0
- data/package/rules/babel.js +1 -1
- data/package/rules/node_modules.js +2 -2
- data/package/rules/sass.js +1 -1
- data/package/utils/__tests__/get_style_rule.js +9 -0
- data/package/utils/deep_merge.js +5 -5
- data/package/utils/get_style_rule.js +7 -12
- data/package/utils/helpers.js +9 -9
- data/test/command_test.rb +6 -0
- data/test/compiler_test.rb +5 -6
- data/test/configuration_test.rb +36 -27
- data/test/dev_server_test.rb +22 -0
- data/test/helper_test.rb +34 -0
- data/test/rake_tasks_test.rb +6 -0
- data/test/test_app/bin/webpack +0 -1
- data/test/test_app/bin/webpack-dev-server +0 -1
- data/test/test_app/config/webpacker.yml +1 -0
- data/test/test_app/public/packs/manifest.json +3 -0
- data/webpacker.gemspec +1 -0
- data/yarn.lock +1934 -1642
- metadata +24 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 123810c157dda2d179ec4c3b27701cf29ade3fbf5a122d08eab68fa6b8c4b8a7
|
4
|
+
data.tar.gz: 6c120aead9282b96fbf070c216d0c2395249deea3ee135f764299d96fd14b423
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04ede9ec043442d4d59a06e60f04fef3483531df5f1f6afbcc175f4252132421b7bd852c637e1be1427508799c5065fad0ea7fe47d5322f56435951a3142b932
|
7
|
+
data.tar.gz: 3ac3f4e8b995982861fa0e5d0771e8244c2f644245dfb8b02b0abccaf3e1485f4677bcd978ac509ebbba2817555ead6d8f92ab9ac02e8ec95c5205b43ac5f7a7
|
data/.node-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
8.16.0
|
data/.rubocop.yml
CHANGED
@@ -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
|
-
|
75
|
+
Enabled: true
|
75
76
|
|
76
77
|
# Defining a method with parameters needs parentheses.
|
77
78
|
Style/MethodDefParentheses:
|
data/.travis.yml
CHANGED
@@ -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.
|
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
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,39 @@
|
|
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
|
+
|
29
|
+
## [[4.0.7]](https://github.com/rails/webpacker/compare/v4.0.6...v4.0.7) - 2019-06-03
|
30
|
+
|
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)
|
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`
|
34
|
+
- `@babel/plugin-transform-runtime` should contain `corejs: false`
|
35
|
+
- Removed unneeded runtime `@babel/runtime-corejs3`
|
36
|
+
|
3
37
|
## [[4.0.6]](https://github.com/rails/webpacker/compare/v4.0.5...v4.0.6) - 2019-05-30
|
4
38
|
|
5
39
|
- Webpack should not be transpiled [#2111](https://github.com/rails/webpacker/pull/2111)
|
@@ -16,24 +50,27 @@
|
|
16
50
|
|
17
51
|
Please see the diff
|
18
52
|
|
19
|
-
|
53
|
+
##### Breaking changes (for pre-existing apps)
|
20
54
|
|
21
|
-
|
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)
|
22
56
|
|
23
57
|
In each of your `/packs/*.js` files, change this:
|
58
|
+
|
24
59
|
```js
|
25
|
-
import
|
60
|
+
import '@babel/polyfill'
|
26
61
|
```
|
62
|
+
|
27
63
|
to this:
|
64
|
+
|
28
65
|
```js
|
29
|
-
import
|
30
|
-
import
|
66
|
+
import 'core-js/stable'
|
67
|
+
import 'regenerator-runtime/runtime'
|
31
68
|
```
|
32
69
|
|
33
|
-
Don't forget install those dependencies directly!
|
70
|
+
Don't forget to install those dependencies directly!
|
34
71
|
|
35
72
|
```sh
|
36
|
-
yarn add
|
73
|
+
yarn add core-js regenerator-runtime
|
37
74
|
```
|
38
75
|
|
39
76
|
## [4.0.2] - 2019-03-06
|
@@ -46,12 +83,10 @@ yarn add --save core-js regenerator-runtime
|
|
46
83
|
|
47
84
|
- Pre-release version installer
|
48
85
|
|
49
|
-
|
50
86
|
## [4.0.0] - 2019-03-04
|
51
87
|
|
52
88
|
No changes in this release. See RC releases for changes.
|
53
89
|
|
54
|
-
|
55
90
|
## [4.0.0.rc.8] - 2019-03-03
|
56
91
|
|
57
92
|
### Fixed
|
@@ -75,9 +110,9 @@ module.exports = environment.toWebpackConfig()
|
|
75
110
|
- Reintroduced `context` to the file loader. Reverting the simpler paths change
|
76
111
|
|
77
112
|
- Updated file loader to have filename based on the path. This change
|
78
|
-
keeps the old behaviour intact i.e. let people use namespaces for media
|
79
|
-
inside `app/javascript` and also include media outside of `app/javascript`
|
80
|
-
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`
|
81
116
|
|
82
117
|
```bash
|
83
118
|
# Files inside app/javascript (i.e. packs source path)
|
@@ -95,14 +130,12 @@ media/webfonts/fa-brands-400-4b115e11.woff2
|
|
95
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
|
96
131
|
`app/javascript`
|
97
132
|
|
98
|
-
|
99
133
|
## [4.0.0.rc.7] - 2019-01-25
|
100
134
|
|
101
135
|
### Fixed
|
102
136
|
|
103
137
|
- Webpacker builds test app assets [#1908](https://github.com/rails/webpacker/issues/1908)
|
104
138
|
|
105
|
-
|
106
139
|
## [4.0.0.rc.6] - 2019-01-25
|
107
140
|
|
108
141
|
### Fixed
|
@@ -148,12 +181,12 @@ fileLoader.use[0].options.context = join(config.source_path) // optional if you
|
|
148
181
|
|
149
182
|
- Gems and node dependencies
|
150
183
|
|
151
|
-
|
152
184
|
## [4.0.0.rc.4] - 2019-01-21
|
153
185
|
|
154
186
|
### Added
|
155
|
-
|
156
|
-
|
187
|
+
|
188
|
+
- `stylesheet_packs_with_chunks_tag` helper, similar to javascript helper but for
|
189
|
+
loading stylesheets chunks.
|
157
190
|
|
158
191
|
```erb
|
159
192
|
<%= stylesheet_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
|
@@ -174,15 +207,15 @@ helper otherwise you will get duplicated chunks on the page.
|
|
174
207
|
# <%= stylesheet_packs_with_chunks_tag 'map' %>
|
175
208
|
```
|
176
209
|
|
177
|
-
|
178
210
|
## [4.0.0.rc.3] - 2019-01-17
|
179
211
|
|
180
212
|
### Fixed
|
181
|
-
- Issue with javascript_pack_tag asset duplication [#1898](https://github.com/rails/webpacker/pull/1898)
|
182
213
|
|
214
|
+
- Issue with javascript_pack_tag asset duplication [#1898](https://github.com/rails/webpacker/pull/1898)
|
183
215
|
|
184
216
|
### Added
|
185
|
-
|
217
|
+
|
218
|
+
- `javascript_packs_with_chunks_tag` helper, which creates html tags
|
186
219
|
for a pack and all the dependent chunks, when using splitchunks.
|
187
220
|
|
188
221
|
```erb
|
@@ -210,68 +243,77 @@ helper otherwise you will get duplicated chunks on the page.
|
|
210
243
|
## [4.0.0.rc.2] - 2018-12-15
|
211
244
|
|
212
245
|
### Fixed
|
213
|
-
- Disable integrity hash generation [#1835](https://github.com/rails/webpacker/issues/1835)
|
214
246
|
|
247
|
+
- Disable integrity hash generation [#1835](https://github.com/rails/webpacker/issues/1835)
|
215
248
|
|
216
249
|
## [4.0.0.rc.1] - 2018-12-14
|
217
250
|
|
218
251
|
### Breaking changes
|
219
252
|
|
220
|
-
|
253
|
+
- Order of rules changed so you might have to change append to prepend,
|
221
254
|
depending on how you want to process packs [#1823](https://github.com/rails/webpacker/pull/1823)
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
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
|
231
268
|
(fixes cases where ES6 libraries were included in the app code) [#1823](https://github.com/rails/webpacker/pull/1823).
|
232
269
|
|
233
|
-
|
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).
|
234
271
|
|
235
|
-
|
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.
|
236
273
|
|
237
|
-
|
274
|
+
To keep previous behavior, remove `nodeModules` loader specifying `environment.loaders.delete('nodeModules');` in your `config/webpack/environment.js` file.
|
238
275
|
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
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
|
+
```
|
246
284
|
|
247
285
|
### Added
|
248
286
|
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
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)
|
260
302
|
|
261
303
|
## [4.0.0-pre.3] - 2018-10-01
|
262
304
|
|
263
305
|
### Added
|
264
306
|
|
265
|
-
|
307
|
+
- Move supported browsers configuration to [.browserslistrc](https://github.com/browserslist/browserslist#queries)
|
266
308
|
|
267
309
|
### Breaking changes
|
268
310
|
|
269
|
-
|
270
|
-
|
311
|
+
- postcss-next is replaced with postcss-preset-env
|
312
|
+
- babel@7
|
271
313
|
|
272
314
|
### Fixed
|
273
315
|
|
274
|
-
|
316
|
+
- Bring back test env [#1563](https://github.com/rails/webpacker/pull/1563)
|
275
317
|
|
276
318
|
Please see a list of [commits](https://github.com/rails/webpacker/compare/2dd68f0273074aadb3f869c4c30369d5e4e3fea7...master)
|
277
319
|
|
@@ -281,36 +323,82 @@ Please see a list of [commits](https://github.com/rails/webpacker/compare/2dd68f
|
|
281
323
|
|
282
324
|
- Webpack dev server version in installer
|
283
325
|
|
284
|
-
|
285
326
|
## [4.0.0-pre.1] - 2018-04-2
|
286
327
|
|
287
328
|
Pre-release to try out webpack 4.0 support
|
288
329
|
|
289
330
|
### Added
|
290
|
-
|
331
|
+
|
332
|
+
- Webpack 4.0 support [#1376](https://github.com/rails/webpacker/pull/1316)
|
333
|
+
|
334
|
+
### Fixed
|
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
|
291
351
|
|
292
352
|
### Fixed
|
293
|
-
- Remove compilation digest file if webpack command fails[#1398](https://github.com/rails/webpacker/issues/1398)
|
294
353
|
|
354
|
+
- Relax Javascript package dependencies [#1466](https://github.com/rails/webpacker/pull/1466#issuecomment-386336605)
|
295
355
|
|
296
|
-
|
297
|
-
|
356
|
+
## [3.5.2] - 2018-04-29
|
357
|
+
|
358
|
+
- Pin Javascript package to 3.5.x
|
359
|
+
|
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)
|
298
386
|
|
299
387
|
## [3.4.1] - 2018-03-24
|
300
388
|
|
301
389
|
### Fixed
|
302
|
-
- Yarn integrity check in development [#1374](https://github.com/rails/webpacker/issues/1374)
|
303
390
|
|
391
|
+
- Yarn integrity check in development [#1374](https://github.com/rails/webpacker/issues/1374)
|
304
392
|
|
305
393
|
## [3.4.0] - 2018-03-23
|
306
394
|
|
307
395
|
**Please use 3.4.1 instead**
|
308
396
|
|
309
397
|
### Added
|
310
|
-
- Support for custom Rails environments [#1359](https://github.com/rails/webpacker/pull/1359)
|
311
398
|
|
312
|
-
|
399
|
+
- Support for custom Rails environments [#1359](https://github.com/rails/webpacker/pull/1359)
|
313
400
|
|
401
|
+
_This could break the compilation if you set NODE_ENV to custom environment. Now, NODE_ENV only understands production or development mode_
|
314
402
|
|
315
403
|
## [3.3.1] - 2018-03-12
|
316
404
|
|
@@ -333,6 +421,7 @@ for further releases and changelogs:
|
|
333
421
|
```
|
334
422
|
bundle exec rails webpacker:binstubs
|
335
423
|
```
|
424
|
+
|
336
425
|
- set function is now removed from plugins and loaders, please use `append` or `prepend`
|
337
426
|
|
338
427
|
```js
|
@@ -346,6 +435,7 @@ environment.loaders.append('json', {
|
|
346
435
|
```
|
347
436
|
|
348
437
|
### Fixed
|
438
|
+
|
349
439
|
- Limit ts-loader to 3.5.0 until webpack 4 support [#1308](https://github.com/rails/webpacker/pull/1308)
|
350
440
|
- Custom env support [#1304](https://github.com/rails/webpacker/pull/1304)
|
351
441
|
|
@@ -379,7 +469,6 @@ And, bunch of bug fixes [See changes](https://github.com/rails/webpacker/compare
|
|
379
469
|
|
380
470
|
- Revert file loader [#1196](https://github.com/rails/webpacker/pull/1196)
|
381
471
|
|
382
|
-
|
383
472
|
## [3.2.0] - 2017-12-16
|
384
473
|
|
385
474
|
### To upgrade:
|
@@ -409,11 +498,11 @@ into your `config/webpack/loaders/`
|
|
409
498
|
directory and add it to webpack build from `config/webpack/environment.js`
|
410
499
|
|
411
500
|
```js
|
412
|
-
const erb =
|
413
|
-
const elm =
|
414
|
-
const typescript =
|
415
|
-
const vue =
|
416
|
-
const 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')
|
417
506
|
|
418
507
|
environment.loaders.append('coffee', coffee)
|
419
508
|
environment.loaders.append('vue', vue)
|
@@ -436,19 +525,16 @@ plugins:
|
|
436
525
|
|
437
526
|
- `postcss-import` in place of `postcss-smart-import`
|
438
527
|
|
439
|
-
|
440
528
|
### Removed (npm module)
|
441
529
|
|
442
530
|
- `postcss-smart-import`, `coffee-loader`, `url-loader`, `rails-erb-loader` as dependencies
|
443
531
|
|
444
|
-
-
|
445
|
-
|
532
|
+
- `publicPath` from file loader [#1107](https://github.com/rails/webpacker/pull/1107)
|
446
533
|
|
447
534
|
### Fixed (npm module)
|
448
535
|
|
449
536
|
- Return native array type for `ConfigList` [#1098](https://github.com/rails/webpacker/pull/1098)
|
450
537
|
|
451
|
-
|
452
538
|
### Added (Gem)
|
453
539
|
|
454
540
|
- New `asset_pack_url` helper [#1102](https://github.com/rails/webpacker/pull/1102)
|
@@ -462,17 +548,14 @@ bundle exec rails webpacker:install:coffee
|
|
462
548
|
|
463
549
|
- Resolved paths from webpacker.yml to compiler watched list
|
464
550
|
|
465
|
-
|
466
551
|
## [3.1.1] - 2017-12-11
|
467
552
|
|
468
553
|
### Fixed
|
469
554
|
|
470
555
|
- Include default webpacker.yml config inside npm package
|
471
556
|
|
472
|
-
|
473
557
|
## [3.1.0] - 2017-12-11
|
474
558
|
|
475
|
-
|
476
559
|
### Added (npm module)
|
477
560
|
|
478
561
|
- Expose base config from environment
|
@@ -482,7 +565,8 @@ environment.config.set('resolve.extensions', ['.foo', '.bar'])
|
|
482
565
|
environment.config.set('output.filename', '[name].js')
|
483
566
|
environment.config.delete('output.chunkFilename')
|
484
567
|
environment.config.get('resolve')
|
485
|
-
environment.config.merge({
|
568
|
+
environment.config.merge({
|
569
|
+
output: {
|
486
570
|
filename: '[name].js'
|
487
571
|
}
|
488
572
|
})
|
@@ -491,7 +575,7 @@ environment.config.merge({ output: {
|
|
491
575
|
- Expose new API's for loaders and plugins to insert at position
|
492
576
|
|
493
577
|
```js
|
494
|
-
const jsonLoader =
|
578
|
+
const jsonLoader = {
|
495
579
|
test: /\.json$/,
|
496
580
|
exclude: /node_modules/,
|
497
581
|
loader: 'json-loader'
|
@@ -499,8 +583,8 @@ const jsonLoader = {
|
|
499
583
|
|
500
584
|
environment.loaders.append('json', jsonLoader)
|
501
585
|
environment.loaders.prepend('json', jsonLoader)
|
502
|
-
environment.loaders.insert('json', jsonLoader, { after: 'style' }
|
503
|
-
environment.loaders.insert('json', jsonLoader, { before: 'babel' }
|
586
|
+
environment.loaders.insert('json', jsonLoader, { after: 'style' })
|
587
|
+
environment.loaders.insert('json', jsonLoader, { before: 'babel' })
|
504
588
|
|
505
589
|
// Update a plugin
|
506
590
|
const manifestPlugin = environment.plugins.get('Manifest')
|
@@ -508,10 +592,14 @@ manifestPlugin.opts.writeToFileEmit = false
|
|
508
592
|
|
509
593
|
// Update coffee loader to use coffeescript 2
|
510
594
|
const babelLoader = environment.loaders.get('babel')
|
511
|
-
environment.loaders.insert(
|
512
|
-
|
513
|
-
|
514
|
-
|
595
|
+
environment.loaders.insert(
|
596
|
+
'coffee',
|
597
|
+
{
|
598
|
+
test: /\.coffee(\.erb)?$/,
|
599
|
+
use: babelLoader.use.concat(['coffee-loader'])
|
600
|
+
},
|
601
|
+
{ before: 'json' }
|
602
|
+
)
|
515
603
|
```
|
516
604
|
|
517
605
|
- Expose `resolve.modules` paths like loaders and plugins
|
@@ -523,8 +611,8 @@ environment.resolvedModules.append('vendor', 'vendor')
|
|
523
611
|
- Enable sourcemaps in `style` and `css` loader
|
524
612
|
|
525
613
|
- Separate `css` and `sass` loader for easier configuration. `style` loader is now
|
526
|
-
`css` loader, which resolves `.css` files and `sass` loader resolves `.scss` and `.sass`
|
527
|
-
files.
|
614
|
+
`css` loader, which resolves `.css` files and `sass` loader resolves `.scss` and `.sass`
|
615
|
+
files.
|
528
616
|
|
529
617
|
```js
|
530
618
|
// Enable css modules with sass loader
|
@@ -560,7 +648,6 @@ dev_server:
|
|
560
648
|
|
561
649
|
- Add url loader to process and embed smaller static files
|
562
650
|
|
563
|
-
|
564
651
|
### Removed
|
565
652
|
|
566
653
|
- resolve url loader [#1042](https://github.com/rails/webpacker/issues/1042)
|
@@ -577,8 +664,7 @@ WEBPACKER_PRECOMPILE=false bundle exec rails assets:precompile
|
|
577
664
|
- Use `WEBPACKER_ASSET_HOST` instead of `ASSET_HOST` for CDN
|
578
665
|
|
579
666
|
- Alias `webpacker:compile` task to `assets:precompile` if is not defined so it works
|
580
|
-
without sprockets
|
581
|
-
|
667
|
+
without sprockets
|
582
668
|
|
583
669
|
## [3.0.2] - 2017-10-04
|
584
670
|
|
@@ -613,7 +699,7 @@ Webpacker.manifest.lookup!('foo.js')
|
|
613
699
|
- Inline CLI args for dev server binstub, use env variables instead
|
614
700
|
|
615
701
|
- Coffeescript as core dependency. You have to manually add coffeescript now, if you are using
|
616
|
-
it in your app.
|
702
|
+
it in your app.
|
617
703
|
|
618
704
|
```bash
|
619
705
|
yarn add coffeescript@1.12.7
|
@@ -645,8 +731,7 @@ yarn add coffeescript
|
|
645
731
|
### Removed
|
646
732
|
|
647
733
|
- `watchContentBase` from devServer config so it doesn't unncessarily trigger
|
648
|
-
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.
|
649
|
-
|
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.
|
650
735
|
|
651
736
|
## [3.0.0] - 2017-08-30
|
652
737
|
|
@@ -655,9 +740,9 @@ live reload when manifest changes. If you have applied this workaround from [#72
|
|
655
740
|
- `resolved_paths` option to allow adding additional paths webpack should lookup when resolving modules
|
656
741
|
|
657
742
|
```yml
|
658
|
-
|
659
|
-
|
660
|
-
|
743
|
+
# config/webpacker.yml
|
744
|
+
# Additional paths webpack should lookup modules
|
745
|
+
resolved_paths: [] # empty by default
|
661
746
|
```
|
662
747
|
|
663
748
|
- `Webpacker::Compiler.fresh?` and `Webpacker::Compiler.stale?` answer the question of whether compilation is needed.
|
@@ -710,8 +795,8 @@ live reload when manifest changes. If you have applied this workaround from [#72
|
|
710
795
|
- Serve assets using `localhost` from dev server - [#424](https://github.com/rails/webpacker/issues/424)
|
711
796
|
|
712
797
|
```yml
|
713
|
-
|
714
|
-
|
798
|
+
dev_server:
|
799
|
+
host: localhost
|
715
800
|
```
|
716
801
|
|
717
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)
|
@@ -721,21 +806,21 @@ live reload when manifest changes. If you have applied this workaround from [#72
|
|
721
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`:
|
722
807
|
|
723
808
|
```yaml
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
809
|
+
default: &default
|
810
|
+
cache_path: tmp/cache/webpacker
|
811
|
+
test:
|
812
|
+
compile: true
|
728
813
|
|
729
|
-
|
730
|
-
|
814
|
+
development:
|
815
|
+
compile: true
|
731
816
|
|
732
|
-
|
733
|
-
|
817
|
+
production:
|
818
|
+
compile: false
|
734
819
|
```
|
735
820
|
|
736
821
|
- Make test compilation cacheable and configurable so that the lazy compilation
|
737
|
-
only triggers if files are changed under tracked paths.
|
738
|
-
Following paths are watched by default -
|
822
|
+
only triggers if files are changed under tracked paths.
|
823
|
+
Following paths are watched by default -
|
739
824
|
|
740
825
|
```rb
|
741
826
|
["app/javascript/**/*", "yarn.lock", "package.json", "config/webpack/**/*"]
|
@@ -751,6 +836,7 @@ Following paths are watched by default -
|
|
751
836
|
## [2.0] - 2017-05-24
|
752
837
|
|
753
838
|
### Fixed
|
839
|
+
|
754
840
|
- Update `.babelrc` to fix compilation issues - [#306](https://github.com/rails/webpacker/issues/306)
|
755
841
|
|
756
842
|
- Duplicated asset hosts - [#320](https://github.com/rails/webpacker/issues/320), [#397](https://github.com/rails/webpacker/pull/397)
|
@@ -763,24 +849,28 @@ Following paths are watched by default -
|
|
763
849
|
|
764
850
|
- ARGV support for `webpack-dev-server` - [#286](https://github.com/rails/webpacker/issues/286)
|
765
851
|
|
766
|
-
|
767
852
|
### Added
|
853
|
+
|
768
854
|
- [Elm](http://elm-lang.org) support. You can now add Elm support via the following methods:
|
855
|
+
|
769
856
|
- New app: `rails new <app> --webpack=elm`
|
770
857
|
- Within an existing app: `rails webpacker:install:elm`
|
771
858
|
|
772
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)
|
773
860
|
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
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
|
+
```
|
784
874
|
|
785
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)
|
786
876
|
|
@@ -789,26 +879,29 @@ Following paths are watched by default -
|
|
789
879
|
```json
|
790
880
|
{
|
791
881
|
"presets": [
|
792
|
-
[
|
793
|
-
"
|
794
|
-
|
795
|
-
"
|
796
|
-
"
|
797
|
-
|
798
|
-
|
799
|
-
|
882
|
+
[
|
883
|
+
"env",
|
884
|
+
{
|
885
|
+
"modules": false,
|
886
|
+
"targets": {
|
887
|
+
"browsers": "> 1%",
|
888
|
+
"uglify": true
|
889
|
+
},
|
890
|
+
"useBuiltIns": true
|
891
|
+
}
|
892
|
+
]
|
800
893
|
],
|
801
894
|
|
802
895
|
"plugins": [
|
803
896
|
"syntax-dynamic-import",
|
804
|
-
"transform-class-properties",
|
897
|
+
"transform-class-properties",
|
898
|
+
{ "spec": true }
|
805
899
|
]
|
806
900
|
}
|
807
901
|
```
|
808
902
|
|
809
903
|
- Source-map support for production bundle
|
810
904
|
|
811
|
-
|
812
905
|
#### Breaking Change
|
813
906
|
|
814
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.
|
@@ -823,14 +916,16 @@ Following paths are watched by default -
|
|
823
916
|
rm config/webpack/development.server.js
|
824
917
|
```
|
825
918
|
|
826
|
-
|
919
|
+
**Warning**: For now you also have to add a pattern in `.gitignore` by hand.
|
920
|
+
|
827
921
|
```diff
|
828
922
|
/public/packs
|
829
923
|
+/public/packs-test
|
830
924
|
/node_modules
|
831
|
-
|
925
|
+
```
|
832
926
|
|
833
927
|
## [1.2] - 2017-04-27
|
928
|
+
|
834
929
|
Some of the changes made requires you to run below commands to install new changes.
|
835
930
|
|
836
931
|
```
|
@@ -838,13 +933,14 @@ bundle update webpacker
|
|
838
933
|
bundle exec rails webpacker:install
|
839
934
|
```
|
840
935
|
|
841
|
-
|
842
936
|
### Fixed
|
937
|
+
|
843
938
|
- Support Spring - [#205](https://github.com/rails/webpacker/issues/205)
|
844
939
|
|
845
940
|
```ruby
|
846
941
|
Spring.after_fork { Webpacker.bootstrap } if defined?(Spring)
|
847
942
|
```
|
943
|
+
|
848
944
|
- Check node version and yarn before installing webpacker - [#217](https://github.com/rails/webpacker/issues/217)
|
849
945
|
|
850
946
|
- Include webpacker helper to views - [#172](https://github.com/rails/webpacker/issues/172)
|
@@ -857,27 +953,28 @@ bundle exec rails webpacker:install
|
|
857
953
|
|
858
954
|
- Move babel presets and plugins to .babelrc - [#202](https://github.com/rails/webpacker/issues/202)
|
859
955
|
|
860
|
-
|
861
956
|
### Added
|
957
|
+
|
862
958
|
- A changelog - [#211](https://github.com/rails/webpacker/issues/211)
|
863
959
|
- Minimize CSS assets - [#218](https://github.com/rails/webpacker/issues/218)
|
864
960
|
- Pack namespacing support - [#201](https://github.com/rails/webpacker/pull/201)
|
865
961
|
|
866
962
|
For example:
|
963
|
+
|
867
964
|
```
|
868
965
|
app/javascript/packs/admin/hello_vue.js
|
869
966
|
app/javascript/packs/admin/hello.vue
|
870
967
|
app/javascript/packs/hello_vue.js
|
871
968
|
app/javascript/packs/hello.vue
|
872
969
|
```
|
970
|
+
|
873
971
|
- Add tree-shaking support - [#250](https://github.com/rails/webpacker/pull/250)
|
874
972
|
- Add initial test case by @kimquy [#259](https://github.com/rails/webpacker/pull/259)
|
875
973
|
- Compile assets before test:controllers and test:system
|
876
974
|
|
877
|
-
|
878
975
|
### Removed
|
879
|
-
- Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)
|
880
976
|
|
977
|
+
- Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)
|
881
978
|
|
882
979
|
## [1.1] - 2017-03-24
|
883
980
|
|
@@ -892,10 +989,10 @@ bundle exec rails webpacker:install:[react, angular, vue]
|
|
892
989
|
```
|
893
990
|
|
894
991
|
### Added (breaking changes)
|
992
|
+
|
895
993
|
- Static assets support - [#153](https://github.com/rails/webpacker/pull/153)
|
896
994
|
- Advanced webpack configuration - [#153](https://github.com/rails/webpacker/pull/153)
|
897
995
|
|
898
|
-
|
899
996
|
### Removed
|
900
997
|
|
901
998
|
```rb
|