webpacker 4.0.7 → 4.1.0
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.
- checksums.yaml +4 -4
- data/.node-version +1 -1
- data/.rubocop.yml +2 -1
- data/.travis.yml +7 -4
- data/CHANGELOG.md +212 -137
- 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 +10 -10
- 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 +16 -14
- 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/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 +15 -0
- data/lib/tasks/webpacker/compile.rake +1 -1
- data/lib/tasks/webpacker/yarn_install.rake +15 -0
- data/lib/webpacker.rb +1 -1
- data/lib/webpacker/commands.rb +26 -0
- 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/helper.rb +39 -13
- data/lib/webpacker/railtie.rb +4 -0
- data/lib/webpacker/version.rb +1 -1
- data/package.json +36 -36
- 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 -1634
- 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: 9f963229e216d0bca7d8df5465f22b533717bc8be3adf863741a192c7861e973
|
4
|
+
data.tar.gz: 629616f4cdd093022317961b93e5aa1af05f6ac76c838f4a1ee9f3572a40ef84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea84ec0b04b8bc519e4cfe2ba0d15c232f14d41995874da3b0faa0397597d62e184c5b9e726e95c73a15a05baf4d89feef1e47081b1bd6ccb9e2139fb85cc01a
|
7
|
+
data.tar.gz: 5209c618fdf30b3e9b39277a672fa97d8b941d31defa973ae8467f1e5daea03e5dfc1af128d65cd4a40ed41be091f8a222929782a044bba6f2f8934c53c4a8b3
|
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,10 +1,22 @@
|
|
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
|
+
## [[4.1.0]](https://github.com/rails/webpacker/compare/v4.0.7...v4.1.0) - 2019-11-12
|
4
|
+
|
5
|
+
- Added favicon_pack_tag to generate favicon links [#2281](https://github.com/rails/webpacker/pull/2281)
|
6
|
+
- Add support for Brotli compression [#2273](https://github.com/rails/webpacker/pull/2273)
|
7
|
+
- Support .(sass|scss).erb [#2259](https://github.com/rails/webpacker/pull/2259)
|
8
|
+
- Elm: Enable production optimizations when compiling in production [#2234](https://github.com/rails/webpacker/pull/2234)
|
9
|
+
- fixes webpacker:clean erroring because of nested hashes [#2318](https://github.com/rails/webpacker/pull/2318)
|
10
|
+
- Revert of production env enforcement [#2341](https://github.com/rails/webpacker/pull/2341)
|
11
|
+
- Add a preload_pack_asset helper [#2124](https://github.com/rails/webpacker/pull/2124)
|
12
|
+
- Record the compilation digest even on webpack error [#2117](https://github.com/rails/webpacker/pull/2117)
|
13
|
+
- See more changes [here](https://github.com/rails/webpacker/compare/v4.0.7...v4.1.0)
|
14
|
+
|
3
15
|
## [[4.0.7]](https://github.com/rails/webpacker/compare/v4.0.6...v4.0.7) - 2019-06-03
|
4
16
|
|
5
17
|
- 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:
|
7
|
-
- `@babel/preset-env` should contain `corejs: 3`
|
18
|
+
- 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):
|
19
|
+
- `@babel/preset-env` should contain `corejs: 3`
|
8
20
|
- `@babel/plugin-transform-runtime` should contain `corejs: false`
|
9
21
|
- Removed unneeded runtime `@babel/runtime-corejs3`
|
10
22
|
|
@@ -26,22 +38,25 @@ Please see the diff
|
|
26
38
|
|
27
39
|
##### Breaking changes (for pre-existing apps)
|
28
40
|
|
29
|
-
|
41
|
+
- [`@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
42
|
|
31
43
|
In each of your `/packs/*.js` files, change this:
|
44
|
+
|
32
45
|
```js
|
33
|
-
import
|
46
|
+
import '@babel/polyfill'
|
34
47
|
```
|
48
|
+
|
35
49
|
to this:
|
50
|
+
|
36
51
|
```js
|
37
|
-
import
|
38
|
-
import
|
52
|
+
import 'core-js/stable'
|
53
|
+
import 'regenerator-runtime/runtime'
|
39
54
|
```
|
40
55
|
|
41
|
-
Don't forget install those dependencies directly!
|
56
|
+
Don't forget to install those dependencies directly!
|
42
57
|
|
43
58
|
```sh
|
44
|
-
yarn add
|
59
|
+
yarn add core-js regenerator-runtime
|
45
60
|
```
|
46
61
|
|
47
62
|
## [4.0.2] - 2019-03-06
|
@@ -54,12 +69,10 @@ yarn add --save core-js regenerator-runtime
|
|
54
69
|
|
55
70
|
- Pre-release version installer
|
56
71
|
|
57
|
-
|
58
72
|
## [4.0.0] - 2019-03-04
|
59
73
|
|
60
74
|
No changes in this release. See RC releases for changes.
|
61
75
|
|
62
|
-
|
63
76
|
## [4.0.0.rc.8] - 2019-03-03
|
64
77
|
|
65
78
|
### Fixed
|
@@ -83,9 +96,9 @@ module.exports = environment.toWebpackConfig()
|
|
83
96
|
- Reintroduced `context` to the file loader. Reverting the simpler paths change
|
84
97
|
|
85
98
|
- 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`
|
99
|
+
keeps the old behaviour intact i.e. let people use namespaces for media
|
100
|
+
inside `app/javascript` and also include media outside of `app/javascript`
|
101
|
+
with simpler paths, for example from `node_modules` or `app/assets`
|
89
102
|
|
90
103
|
```bash
|
91
104
|
# Files inside app/javascript (i.e. packs source path)
|
@@ -103,14 +116,12 @@ media/webfonts/fa-brands-400-4b115e11.woff2
|
|
103
116
|
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
117
|
`app/javascript`
|
105
118
|
|
106
|
-
|
107
119
|
## [4.0.0.rc.7] - 2019-01-25
|
108
120
|
|
109
121
|
### Fixed
|
110
122
|
|
111
123
|
- Webpacker builds test app assets [#1908](https://github.com/rails/webpacker/issues/1908)
|
112
124
|
|
113
|
-
|
114
125
|
## [4.0.0.rc.6] - 2019-01-25
|
115
126
|
|
116
127
|
### Fixed
|
@@ -156,12 +167,12 @@ fileLoader.use[0].options.context = join(config.source_path) // optional if you
|
|
156
167
|
|
157
168
|
- Gems and node dependencies
|
158
169
|
|
159
|
-
|
160
170
|
## [4.0.0.rc.4] - 2019-01-21
|
161
171
|
|
162
172
|
### Added
|
163
|
-
|
164
|
-
|
173
|
+
|
174
|
+
- `stylesheet_packs_with_chunks_tag` helper, similar to javascript helper but for
|
175
|
+
loading stylesheets chunks.
|
165
176
|
|
166
177
|
```erb
|
167
178
|
<%= stylesheet_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
|
@@ -182,15 +193,15 @@ helper otherwise you will get duplicated chunks on the page.
|
|
182
193
|
# <%= stylesheet_packs_with_chunks_tag 'map' %>
|
183
194
|
```
|
184
195
|
|
185
|
-
|
186
196
|
## [4.0.0.rc.3] - 2019-01-17
|
187
197
|
|
188
198
|
### Fixed
|
189
|
-
- Issue with javascript_pack_tag asset duplication [#1898](https://github.com/rails/webpacker/pull/1898)
|
190
199
|
|
200
|
+
- Issue with javascript_pack_tag asset duplication [#1898](https://github.com/rails/webpacker/pull/1898)
|
191
201
|
|
192
202
|
### Added
|
193
|
-
|
203
|
+
|
204
|
+
- `javascript_packs_with_chunks_tag` helper, which creates html tags
|
194
205
|
for a pack and all the dependent chunks, when using splitchunks.
|
195
206
|
|
196
207
|
```erb
|
@@ -218,68 +229,77 @@ helper otherwise you will get duplicated chunks on the page.
|
|
218
229
|
## [4.0.0.rc.2] - 2018-12-15
|
219
230
|
|
220
231
|
### Fixed
|
221
|
-
- Disable integrity hash generation [#1835](https://github.com/rails/webpacker/issues/1835)
|
222
232
|
|
233
|
+
- Disable integrity hash generation [#1835](https://github.com/rails/webpacker/issues/1835)
|
223
234
|
|
224
235
|
## [4.0.0.rc.1] - 2018-12-14
|
225
236
|
|
226
237
|
### Breaking changes
|
227
238
|
|
228
|
-
|
239
|
+
- Order of rules changed so you might have to change append to prepend,
|
229
240
|
depending on how you want to process packs [#1823](https://github.com/rails/webpacker/pull/1823)
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
241
|
+
|
242
|
+
```js
|
243
|
+
environment.loaders.prepend()
|
244
|
+
```
|
245
|
+
|
246
|
+
- Separate CSS extraction from build environment [#1625](https://github.com/rails/webpacker/pull/1625)
|
247
|
+
|
248
|
+
```yml
|
249
|
+
# Extract and emit a css file
|
250
|
+
extract_css: true
|
251
|
+
```
|
252
|
+
|
253
|
+
- Separate rule to compile node modules
|
239
254
|
(fixes cases where ES6 libraries were included in the app code) [#1823](https://github.com/rails/webpacker/pull/1823).
|
240
255
|
|
241
|
-
|
256
|
+
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
257
|
|
243
|
-
|
258
|
+
[`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
259
|
|
245
|
-
|
260
|
+
To keep previous behavior, remove `nodeModules` loader specifying `environment.loaders.delete('nodeModules');` in your `config/webpack/environment.js` file.
|
246
261
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
262
|
+
- File loader extensions API [#1823](https://github.com/rails/webpacker/pull/1823)
|
263
|
+
|
264
|
+
```yml
|
265
|
+
# webpacker.yml
|
266
|
+
static_assets_extensions:
|
267
|
+
- .pdf
|
268
|
+
# etc..
|
269
|
+
```
|
254
270
|
|
255
271
|
### Added
|
256
272
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
273
|
+
- Move `.babelrc` and `.postcssrc` to `.js` variant [#1822](https://github.com/rails/webpacker/pull/1822)
|
274
|
+
- Use postcss safe parser when optimising css assets [#1822](https://github.com/rails/webpacker/pull/1822)
|
275
|
+
- Add split chunks api (undocumented)
|
276
|
+
|
277
|
+
```js
|
278
|
+
const { environment } = require('@rails/webpacker')
|
279
|
+
// Enable with default config
|
280
|
+
environment.splitChunks()
|
281
|
+
// Configure via a callback
|
282
|
+
environment.splitChunks(config =>
|
283
|
+
Object.assign({}, config, { optimization: { splitChunks: false } })
|
284
|
+
)
|
285
|
+
```
|
286
|
+
|
287
|
+
- Allow changing static file extensions using webpacker.yml (undocumented)
|
268
288
|
|
269
289
|
## [4.0.0-pre.3] - 2018-10-01
|
270
290
|
|
271
291
|
### Added
|
272
292
|
|
273
|
-
|
293
|
+
- Move supported browsers configuration to [.browserslistrc](https://github.com/browserslist/browserslist#queries)
|
274
294
|
|
275
295
|
### Breaking changes
|
276
296
|
|
277
|
-
|
278
|
-
|
297
|
+
- postcss-next is replaced with postcss-preset-env
|
298
|
+
- babel@7
|
279
299
|
|
280
300
|
### Fixed
|
281
301
|
|
282
|
-
|
302
|
+
- Bring back test env [#1563](https://github.com/rails/webpacker/pull/1563)
|
283
303
|
|
284
304
|
Please see a list of [commits](https://github.com/rails/webpacker/compare/2dd68f0273074aadb3f869c4c30369d5e4e3fea7...master)
|
285
305
|
|
@@ -289,36 +309,82 @@ Please see a list of [commits](https://github.com/rails/webpacker/compare/2dd68f
|
|
289
309
|
|
290
310
|
- Webpack dev server version in installer
|
291
311
|
|
292
|
-
|
293
312
|
## [4.0.0-pre.1] - 2018-04-2
|
294
313
|
|
295
314
|
Pre-release to try out webpack 4.0 support
|
296
315
|
|
297
316
|
### Added
|
298
|
-
|
317
|
+
|
318
|
+
- Webpack 4.0 support [#1376](https://github.com/rails/webpacker/pull/1316)
|
299
319
|
|
300
320
|
### Fixed
|
301
|
-
- Remove compilation digest file if webpack command fails[#1398](https://github.com/rails/webpacker/issues/1398)
|
302
321
|
|
322
|
+
- Remove compilation digest file if webpack command fails[#1398](https://github.com/rails/webpacker/issues/1398)
|
323
|
+
|
324
|
+
## [3.6.0] - 2019-03-06
|
325
|
+
|
326
|
+
See changes: https://github.com/rails/webpacker/compare/88a253ed42966eb2d5c997435e9396881513bce1...3-x-stable
|
303
327
|
|
304
|
-
|
305
|
-
|
328
|
+
## [3.5.5] - 2018-07-09
|
329
|
+
|
330
|
+
See changes: https://github.com/rails/webpacker/compare/e8b197e36c77181ca2e4765c620faea59dcd0351...3-x-stable
|
331
|
+
|
332
|
+
### Added
|
333
|
+
|
334
|
+
- On CI, sort files & check modified w/ digest intead of mtime[#1522](https://github.com/rails/webpacker/pull/1522)
|
335
|
+
|
336
|
+
## [3.5.3] - 2018-05-03
|
337
|
+
|
338
|
+
### Fixed
|
339
|
+
|
340
|
+
- Relax Javascript package dependencies [#1466](https://github.com/rails/webpacker/pull/1466#issuecomment-386336605)
|
341
|
+
|
342
|
+
## [3.5.2] - 2018-04-29
|
343
|
+
|
344
|
+
- Pin Javascript package to 3.5.x
|
345
|
+
|
346
|
+
## [3.5.1] - 2018-04-29
|
347
|
+
|
348
|
+
- Upgraded gems and Javascript packages
|
349
|
+
|
350
|
+
## [3.5.0] - 2018-04-29
|
351
|
+
|
352
|
+
### Fixed
|
353
|
+
|
354
|
+
- Remove compilation digest file if webpack command fails [#1399](https://github.com/rails/webpacker/pull/1399)
|
355
|
+
- Handle http dev_server setting properly in the proxy [#1420](https://github.com/rails/webpacker/pull/1420)
|
356
|
+
- Use correct protocol [#1425](https://github.com/rails/webpacker/pull/1425)
|
357
|
+
|
358
|
+
### Added
|
359
|
+
|
360
|
+
- `image_pack_tag` helper [#1400](https://github.com/rails/webpacker/pull/1400)
|
361
|
+
- devserver proxy for custom environments [#1415](https://github.com/rails/webpacker/pull/1415)
|
362
|
+
- Rails webpacker:info task [#1416](https://github.com/rails/webpacker/pull/1416)
|
363
|
+
- Include `RAILS_RELATIVE_URL_ROOT` environment variable in publicPath [#1428](https://github.com/rails/webpacker/pull/1428)
|
364
|
+
|
365
|
+
Complete list of changes: [#1464](https://github.com/rails/webpacker/pull/1464)
|
366
|
+
|
367
|
+
## [3.4.3] - 2018-04-3
|
368
|
+
|
369
|
+
### Fixed
|
370
|
+
|
371
|
+
- Lock webpacker version in installer [#1401](https://github.com/rails/webpacker/issues/1401)
|
306
372
|
|
307
373
|
## [3.4.1] - 2018-03-24
|
308
374
|
|
309
375
|
### Fixed
|
310
|
-
- Yarn integrity check in development [#1374](https://github.com/rails/webpacker/issues/1374)
|
311
376
|
|
377
|
+
- Yarn integrity check in development [#1374](https://github.com/rails/webpacker/issues/1374)
|
312
378
|
|
313
379
|
## [3.4.0] - 2018-03-23
|
314
380
|
|
315
381
|
**Please use 3.4.1 instead**
|
316
382
|
|
317
383
|
### Added
|
318
|
-
- Support for custom Rails environments [#1359](https://github.com/rails/webpacker/pull/1359)
|
319
384
|
|
320
|
-
|
385
|
+
- Support for custom Rails environments [#1359](https://github.com/rails/webpacker/pull/1359)
|
321
386
|
|
387
|
+
_This could break the compilation if you set NODE_ENV to custom environment. Now, NODE_ENV only understands production or development mode_
|
322
388
|
|
323
389
|
## [3.3.1] - 2018-03-12
|
324
390
|
|
@@ -341,6 +407,7 @@ for further releases and changelogs:
|
|
341
407
|
```
|
342
408
|
bundle exec rails webpacker:binstubs
|
343
409
|
```
|
410
|
+
|
344
411
|
- set function is now removed from plugins and loaders, please use `append` or `prepend`
|
345
412
|
|
346
413
|
```js
|
@@ -354,6 +421,7 @@ environment.loaders.append('json', {
|
|
354
421
|
```
|
355
422
|
|
356
423
|
### Fixed
|
424
|
+
|
357
425
|
- Limit ts-loader to 3.5.0 until webpack 4 support [#1308](https://github.com/rails/webpacker/pull/1308)
|
358
426
|
- Custom env support [#1304](https://github.com/rails/webpacker/pull/1304)
|
359
427
|
|
@@ -387,7 +455,6 @@ And, bunch of bug fixes [See changes](https://github.com/rails/webpacker/compare
|
|
387
455
|
|
388
456
|
- Revert file loader [#1196](https://github.com/rails/webpacker/pull/1196)
|
389
457
|
|
390
|
-
|
391
458
|
## [3.2.0] - 2017-12-16
|
392
459
|
|
393
460
|
### To upgrade:
|
@@ -417,11 +484,11 @@ into your `config/webpack/loaders/`
|
|
417
484
|
directory and add it to webpack build from `config/webpack/environment.js`
|
418
485
|
|
419
486
|
```js
|
420
|
-
const erb =
|
421
|
-
const elm =
|
422
|
-
const typescript =
|
423
|
-
const vue =
|
424
|
-
const coffee =
|
487
|
+
const erb = require('./loaders/erb')
|
488
|
+
const elm = require('./loaders/elm')
|
489
|
+
const typescript = require('./loaders/typescript')
|
490
|
+
const vue = require('./loaders/vue')
|
491
|
+
const coffee = require('./loaders/coffee')
|
425
492
|
|
426
493
|
environment.loaders.append('coffee', coffee)
|
427
494
|
environment.loaders.append('vue', vue)
|
@@ -444,19 +511,16 @@ plugins:
|
|
444
511
|
|
445
512
|
- `postcss-import` in place of `postcss-smart-import`
|
446
513
|
|
447
|
-
|
448
514
|
### Removed (npm module)
|
449
515
|
|
450
516
|
- `postcss-smart-import`, `coffee-loader`, `url-loader`, `rails-erb-loader` as dependencies
|
451
517
|
|
452
|
-
-
|
453
|
-
|
518
|
+
- `publicPath` from file loader [#1107](https://github.com/rails/webpacker/pull/1107)
|
454
519
|
|
455
520
|
### Fixed (npm module)
|
456
521
|
|
457
522
|
- Return native array type for `ConfigList` [#1098](https://github.com/rails/webpacker/pull/1098)
|
458
523
|
|
459
|
-
|
460
524
|
### Added (Gem)
|
461
525
|
|
462
526
|
- New `asset_pack_url` helper [#1102](https://github.com/rails/webpacker/pull/1102)
|
@@ -470,17 +534,14 @@ bundle exec rails webpacker:install:coffee
|
|
470
534
|
|
471
535
|
- Resolved paths from webpacker.yml to compiler watched list
|
472
536
|
|
473
|
-
|
474
537
|
## [3.1.1] - 2017-12-11
|
475
538
|
|
476
539
|
### Fixed
|
477
540
|
|
478
541
|
- Include default webpacker.yml config inside npm package
|
479
542
|
|
480
|
-
|
481
543
|
## [3.1.0] - 2017-12-11
|
482
544
|
|
483
|
-
|
484
545
|
### Added (npm module)
|
485
546
|
|
486
547
|
- Expose base config from environment
|
@@ -490,7 +551,8 @@ environment.config.set('resolve.extensions', ['.foo', '.bar'])
|
|
490
551
|
environment.config.set('output.filename', '[name].js')
|
491
552
|
environment.config.delete('output.chunkFilename')
|
492
553
|
environment.config.get('resolve')
|
493
|
-
environment.config.merge({
|
554
|
+
environment.config.merge({
|
555
|
+
output: {
|
494
556
|
filename: '[name].js'
|
495
557
|
}
|
496
558
|
})
|
@@ -499,7 +561,7 @@ environment.config.merge({ output: {
|
|
499
561
|
- Expose new API's for loaders and plugins to insert at position
|
500
562
|
|
501
563
|
```js
|
502
|
-
const jsonLoader =
|
564
|
+
const jsonLoader = {
|
503
565
|
test: /\.json$/,
|
504
566
|
exclude: /node_modules/,
|
505
567
|
loader: 'json-loader'
|
@@ -507,8 +569,8 @@ const jsonLoader = {
|
|
507
569
|
|
508
570
|
environment.loaders.append('json', jsonLoader)
|
509
571
|
environment.loaders.prepend('json', jsonLoader)
|
510
|
-
environment.loaders.insert('json', jsonLoader, { after: 'style' }
|
511
|
-
environment.loaders.insert('json', jsonLoader, { before: 'babel' }
|
572
|
+
environment.loaders.insert('json', jsonLoader, { after: 'style' })
|
573
|
+
environment.loaders.insert('json', jsonLoader, { before: 'babel' })
|
512
574
|
|
513
575
|
// Update a plugin
|
514
576
|
const manifestPlugin = environment.plugins.get('Manifest')
|
@@ -516,10 +578,14 @@ manifestPlugin.opts.writeToFileEmit = false
|
|
516
578
|
|
517
579
|
// Update coffee loader to use coffeescript 2
|
518
580
|
const babelLoader = environment.loaders.get('babel')
|
519
|
-
environment.loaders.insert(
|
520
|
-
|
521
|
-
|
522
|
-
|
581
|
+
environment.loaders.insert(
|
582
|
+
'coffee',
|
583
|
+
{
|
584
|
+
test: /\.coffee(\.erb)?$/,
|
585
|
+
use: babelLoader.use.concat(['coffee-loader'])
|
586
|
+
},
|
587
|
+
{ before: 'json' }
|
588
|
+
)
|
523
589
|
```
|
524
590
|
|
525
591
|
- Expose `resolve.modules` paths like loaders and plugins
|
@@ -531,8 +597,8 @@ environment.resolvedModules.append('vendor', 'vendor')
|
|
531
597
|
- Enable sourcemaps in `style` and `css` loader
|
532
598
|
|
533
599
|
- 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.
|
600
|
+
`css` loader, which resolves `.css` files and `sass` loader resolves `.scss` and `.sass`
|
601
|
+
files.
|
536
602
|
|
537
603
|
```js
|
538
604
|
// Enable css modules with sass loader
|
@@ -568,7 +634,6 @@ dev_server:
|
|
568
634
|
|
569
635
|
- Add url loader to process and embed smaller static files
|
570
636
|
|
571
|
-
|
572
637
|
### Removed
|
573
638
|
|
574
639
|
- resolve url loader [#1042](https://github.com/rails/webpacker/issues/1042)
|
@@ -585,8 +650,7 @@ WEBPACKER_PRECOMPILE=false bundle exec rails assets:precompile
|
|
585
650
|
- Use `WEBPACKER_ASSET_HOST` instead of `ASSET_HOST` for CDN
|
586
651
|
|
587
652
|
- Alias `webpacker:compile` task to `assets:precompile` if is not defined so it works
|
588
|
-
without sprockets
|
589
|
-
|
653
|
+
without sprockets
|
590
654
|
|
591
655
|
## [3.0.2] - 2017-10-04
|
592
656
|
|
@@ -621,7 +685,7 @@ Webpacker.manifest.lookup!('foo.js')
|
|
621
685
|
- Inline CLI args for dev server binstub, use env variables instead
|
622
686
|
|
623
687
|
- Coffeescript as core dependency. You have to manually add coffeescript now, if you are using
|
624
|
-
it in your app.
|
688
|
+
it in your app.
|
625
689
|
|
626
690
|
```bash
|
627
691
|
yarn add coffeescript@1.12.7
|
@@ -653,8 +717,7 @@ yarn add coffeescript
|
|
653
717
|
### Removed
|
654
718
|
|
655
719
|
- `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
|
-
|
720
|
+
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
721
|
|
659
722
|
## [3.0.0] - 2017-08-30
|
660
723
|
|
@@ -663,9 +726,9 @@ live reload when manifest changes. If you have applied this workaround from [#72
|
|
663
726
|
- `resolved_paths` option to allow adding additional paths webpack should lookup when resolving modules
|
664
727
|
|
665
728
|
```yml
|
666
|
-
|
667
|
-
|
668
|
-
|
729
|
+
# config/webpacker.yml
|
730
|
+
# Additional paths webpack should lookup modules
|
731
|
+
resolved_paths: [] # empty by default
|
669
732
|
```
|
670
733
|
|
671
734
|
- `Webpacker::Compiler.fresh?` and `Webpacker::Compiler.stale?` answer the question of whether compilation is needed.
|
@@ -718,8 +781,8 @@ live reload when manifest changes. If you have applied this workaround from [#72
|
|
718
781
|
- Serve assets using `localhost` from dev server - [#424](https://github.com/rails/webpacker/issues/424)
|
719
782
|
|
720
783
|
```yml
|
721
|
-
|
722
|
-
|
784
|
+
dev_server:
|
785
|
+
host: localhost
|
723
786
|
```
|
724
787
|
|
725
788
|
- 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 +792,21 @@ live reload when manifest changes. If you have applied this workaround from [#72
|
|
729
792
|
- 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
793
|
|
731
794
|
```yaml
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
795
|
+
default: &default
|
796
|
+
cache_path: tmp/cache/webpacker
|
797
|
+
test:
|
798
|
+
compile: true
|
736
799
|
|
737
|
-
|
738
|
-
|
800
|
+
development:
|
801
|
+
compile: true
|
739
802
|
|
740
|
-
|
741
|
-
|
803
|
+
production:
|
804
|
+
compile: false
|
742
805
|
```
|
743
806
|
|
744
807
|
- 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 -
|
808
|
+
only triggers if files are changed under tracked paths.
|
809
|
+
Following paths are watched by default -
|
747
810
|
|
748
811
|
```rb
|
749
812
|
["app/javascript/**/*", "yarn.lock", "package.json", "config/webpack/**/*"]
|
@@ -759,6 +822,7 @@ Following paths are watched by default -
|
|
759
822
|
## [2.0] - 2017-05-24
|
760
823
|
|
761
824
|
### Fixed
|
825
|
+
|
762
826
|
- Update `.babelrc` to fix compilation issues - [#306](https://github.com/rails/webpacker/issues/306)
|
763
827
|
|
764
828
|
- Duplicated asset hosts - [#320](https://github.com/rails/webpacker/issues/320), [#397](https://github.com/rails/webpacker/pull/397)
|
@@ -771,24 +835,28 @@ Following paths are watched by default -
|
|
771
835
|
|
772
836
|
- ARGV support for `webpack-dev-server` - [#286](https://github.com/rails/webpacker/issues/286)
|
773
837
|
|
774
|
-
|
775
838
|
### Added
|
839
|
+
|
776
840
|
- [Elm](http://elm-lang.org) support. You can now add Elm support via the following methods:
|
841
|
+
|
777
842
|
- New app: `rails new <app> --webpack=elm`
|
778
843
|
- Within an existing app: `rails webpacker:install:elm`
|
779
844
|
|
780
845
|
- 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
846
|
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
847
|
+
Before (compile to `public/packs`):
|
848
|
+
|
849
|
+
```yaml
|
850
|
+
source_entry_path: packs
|
851
|
+
public_output_path: packs
|
852
|
+
```
|
853
|
+
|
854
|
+
After (compile to `public/sweet/js`):
|
855
|
+
|
856
|
+
```yaml
|
857
|
+
source_entry_path: packs
|
858
|
+
public_output_path: sweet/js
|
859
|
+
```
|
792
860
|
|
793
861
|
- `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
862
|
|
@@ -797,26 +865,29 @@ Following paths are watched by default -
|
|
797
865
|
```json
|
798
866
|
{
|
799
867
|
"presets": [
|
800
|
-
[
|
801
|
-
"
|
802
|
-
|
803
|
-
"
|
804
|
-
"
|
805
|
-
|
806
|
-
|
807
|
-
|
868
|
+
[
|
869
|
+
"env",
|
870
|
+
{
|
871
|
+
"modules": false,
|
872
|
+
"targets": {
|
873
|
+
"browsers": "> 1%",
|
874
|
+
"uglify": true
|
875
|
+
},
|
876
|
+
"useBuiltIns": true
|
877
|
+
}
|
878
|
+
]
|
808
879
|
],
|
809
880
|
|
810
881
|
"plugins": [
|
811
882
|
"syntax-dynamic-import",
|
812
|
-
"transform-class-properties",
|
883
|
+
"transform-class-properties",
|
884
|
+
{ "spec": true }
|
813
885
|
]
|
814
886
|
}
|
815
887
|
```
|
816
888
|
|
817
889
|
- Source-map support for production bundle
|
818
890
|
|
819
|
-
|
820
891
|
#### Breaking Change
|
821
892
|
|
822
893
|
- 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 +902,16 @@ Following paths are watched by default -
|
|
831
902
|
rm config/webpack/development.server.js
|
832
903
|
```
|
833
904
|
|
834
|
-
|
905
|
+
**Warning**: For now you also have to add a pattern in `.gitignore` by hand.
|
906
|
+
|
835
907
|
```diff
|
836
908
|
/public/packs
|
837
909
|
+/public/packs-test
|
838
910
|
/node_modules
|
839
|
-
|
911
|
+
```
|
840
912
|
|
841
913
|
## [1.2] - 2017-04-27
|
914
|
+
|
842
915
|
Some of the changes made requires you to run below commands to install new changes.
|
843
916
|
|
844
917
|
```
|
@@ -846,13 +919,14 @@ bundle update webpacker
|
|
846
919
|
bundle exec rails webpacker:install
|
847
920
|
```
|
848
921
|
|
849
|
-
|
850
922
|
### Fixed
|
923
|
+
|
851
924
|
- Support Spring - [#205](https://github.com/rails/webpacker/issues/205)
|
852
925
|
|
853
926
|
```ruby
|
854
927
|
Spring.after_fork { Webpacker.bootstrap } if defined?(Spring)
|
855
928
|
```
|
929
|
+
|
856
930
|
- Check node version and yarn before installing webpacker - [#217](https://github.com/rails/webpacker/issues/217)
|
857
931
|
|
858
932
|
- Include webpacker helper to views - [#172](https://github.com/rails/webpacker/issues/172)
|
@@ -865,27 +939,28 @@ bundle exec rails webpacker:install
|
|
865
939
|
|
866
940
|
- Move babel presets and plugins to .babelrc - [#202](https://github.com/rails/webpacker/issues/202)
|
867
941
|
|
868
|
-
|
869
942
|
### Added
|
943
|
+
|
870
944
|
- A changelog - [#211](https://github.com/rails/webpacker/issues/211)
|
871
945
|
- Minimize CSS assets - [#218](https://github.com/rails/webpacker/issues/218)
|
872
946
|
- Pack namespacing support - [#201](https://github.com/rails/webpacker/pull/201)
|
873
947
|
|
874
948
|
For example:
|
949
|
+
|
875
950
|
```
|
876
951
|
app/javascript/packs/admin/hello_vue.js
|
877
952
|
app/javascript/packs/admin/hello.vue
|
878
953
|
app/javascript/packs/hello_vue.js
|
879
954
|
app/javascript/packs/hello.vue
|
880
955
|
```
|
956
|
+
|
881
957
|
- Add tree-shaking support - [#250](https://github.com/rails/webpacker/pull/250)
|
882
958
|
- Add initial test case by @kimquy [#259](https://github.com/rails/webpacker/pull/259)
|
883
959
|
- Compile assets before test:controllers and test:system
|
884
960
|
|
885
|
-
|
886
961
|
### Removed
|
887
|
-
- Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)
|
888
962
|
|
963
|
+
- Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)
|
889
964
|
|
890
965
|
## [1.1] - 2017-03-24
|
891
966
|
|
@@ -900,10 +975,10 @@ bundle exec rails webpacker:install:[react, angular, vue]
|
|
900
975
|
```
|
901
976
|
|
902
977
|
### Added (breaking changes)
|
978
|
+
|
903
979
|
- Static assets support - [#153](https://github.com/rails/webpacker/pull/153)
|
904
980
|
- Advanced webpack configuration - [#153](https://github.com/rails/webpacker/pull/153)
|
905
981
|
|
906
|
-
|
907
982
|
### Removed
|
908
983
|
|
909
984
|
```rb
|