webpacker 4.0.3 → 4.1.0
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 +244 -129
- data/Gemfile.lock +79 -60
- 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/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 -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 -1
- 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 +2 -1
- data/yarn.lock +1934 -1642
- metadata +24 -10
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,9 +1,64 @@
|
|
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
|
+
|
15
|
+
## [[4.0.7]](https://github.com/rails/webpacker/compare/v4.0.6...v4.0.7) - 2019-06-03
|
16
|
+
|
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)
|
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`
|
20
|
+
- `@babel/plugin-transform-runtime` should contain `corejs: false`
|
21
|
+
- Removed unneeded runtime `@babel/runtime-corejs3`
|
22
|
+
|
23
|
+
## [[4.0.6]](https://github.com/rails/webpacker/compare/v4.0.5...v4.0.6) - 2019-05-30
|
24
|
+
|
25
|
+
- Webpack should not be transpiled [#2111](https://github.com/rails/webpacker/pull/2111)
|
26
|
+
|
27
|
+
## [[4.0.5]](https://github.com/rails/webpacker/compare/v4.0.4...v4.0.5) - 2019-05-30
|
28
|
+
|
29
|
+
- Don't let babel & core-js transpile each other [#2110](https://github.com/rails/webpacker/pull/2110)
|
30
|
+
|
31
|
+
## [[4.0.4]](https://github.com/rails/webpacker/compare/v4.0.3...v4.0.4) - 2019-05-28
|
32
|
+
|
33
|
+
- Remove bundler version constraint
|
34
|
+
|
3
35
|
## [[4.0.3]](https://github.com/rails/webpacker/compare/v4.0.2...v4.0.3) - 2019-05-28
|
4
36
|
|
5
37
|
Please see the diff
|
6
38
|
|
39
|
+
##### Breaking changes (for pre-existing apps)
|
40
|
+
|
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)
|
42
|
+
|
43
|
+
In each of your `/packs/*.js` files, change this:
|
44
|
+
|
45
|
+
```js
|
46
|
+
import '@babel/polyfill'
|
47
|
+
```
|
48
|
+
|
49
|
+
to this:
|
50
|
+
|
51
|
+
```js
|
52
|
+
import 'core-js/stable'
|
53
|
+
import 'regenerator-runtime/runtime'
|
54
|
+
```
|
55
|
+
|
56
|
+
Don't forget to install those dependencies directly!
|
57
|
+
|
58
|
+
```sh
|
59
|
+
yarn add core-js regenerator-runtime
|
60
|
+
```
|
61
|
+
|
7
62
|
## [4.0.2] - 2019-03-06
|
8
63
|
|
9
64
|
- Bump the version on npm
|
@@ -14,12 +69,10 @@ Please see the diff
|
|
14
69
|
|
15
70
|
- Pre-release version installer
|
16
71
|
|
17
|
-
|
18
72
|
## [4.0.0] - 2019-03-04
|
19
73
|
|
20
74
|
No changes in this release. See RC releases for changes.
|
21
75
|
|
22
|
-
|
23
76
|
## [4.0.0.rc.8] - 2019-03-03
|
24
77
|
|
25
78
|
### Fixed
|
@@ -43,9 +96,9 @@ module.exports = environment.toWebpackConfig()
|
|
43
96
|
- Reintroduced `context` to the file loader. Reverting the simpler paths change
|
44
97
|
|
45
98
|
- Updated file loader to have filename based on the path. This change
|
46
|
-
keeps the old behaviour intact i.e. let people use namespaces for media
|
47
|
-
inside `app/javascript` and also include media outside of `app/javascript`
|
48
|
-
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`
|
49
102
|
|
50
103
|
```bash
|
51
104
|
# Files inside app/javascript (i.e. packs source path)
|
@@ -63,14 +116,12 @@ media/webfonts/fa-brands-400-4b115e11.woff2
|
|
63
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
|
64
117
|
`app/javascript`
|
65
118
|
|
66
|
-
|
67
119
|
## [4.0.0.rc.7] - 2019-01-25
|
68
120
|
|
69
121
|
### Fixed
|
70
122
|
|
71
123
|
- Webpacker builds test app assets [#1908](https://github.com/rails/webpacker/issues/1908)
|
72
124
|
|
73
|
-
|
74
125
|
## [4.0.0.rc.6] - 2019-01-25
|
75
126
|
|
76
127
|
### Fixed
|
@@ -116,12 +167,12 @@ fileLoader.use[0].options.context = join(config.source_path) // optional if you
|
|
116
167
|
|
117
168
|
- Gems and node dependencies
|
118
169
|
|
119
|
-
|
120
170
|
## [4.0.0.rc.4] - 2019-01-21
|
121
171
|
|
122
172
|
### Added
|
123
|
-
|
124
|
-
|
173
|
+
|
174
|
+
- `stylesheet_packs_with_chunks_tag` helper, similar to javascript helper but for
|
175
|
+
loading stylesheets chunks.
|
125
176
|
|
126
177
|
```erb
|
127
178
|
<%= stylesheet_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
|
@@ -142,15 +193,15 @@ helper otherwise you will get duplicated chunks on the page.
|
|
142
193
|
# <%= stylesheet_packs_with_chunks_tag 'map' %>
|
143
194
|
```
|
144
195
|
|
145
|
-
|
146
196
|
## [4.0.0.rc.3] - 2019-01-17
|
147
197
|
|
148
198
|
### Fixed
|
149
|
-
- Issue with javascript_pack_tag asset duplication [#1898](https://github.com/rails/webpacker/pull/1898)
|
150
199
|
|
200
|
+
- Issue with javascript_pack_tag asset duplication [#1898](https://github.com/rails/webpacker/pull/1898)
|
151
201
|
|
152
202
|
### Added
|
153
|
-
|
203
|
+
|
204
|
+
- `javascript_packs_with_chunks_tag` helper, which creates html tags
|
154
205
|
for a pack and all the dependent chunks, when using splitchunks.
|
155
206
|
|
156
207
|
```erb
|
@@ -178,68 +229,77 @@ helper otherwise you will get duplicated chunks on the page.
|
|
178
229
|
## [4.0.0.rc.2] - 2018-12-15
|
179
230
|
|
180
231
|
### Fixed
|
181
|
-
- Disable integrity hash generation [#1835](https://github.com/rails/webpacker/issues/1835)
|
182
232
|
|
233
|
+
- Disable integrity hash generation [#1835](https://github.com/rails/webpacker/issues/1835)
|
183
234
|
|
184
235
|
## [4.0.0.rc.1] - 2018-12-14
|
185
236
|
|
186
237
|
### Breaking changes
|
187
238
|
|
188
|
-
|
239
|
+
- Order of rules changed so you might have to change append to prepend,
|
189
240
|
depending on how you want to process packs [#1823](https://github.com/rails/webpacker/pull/1823)
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
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
|
199
254
|
(fixes cases where ES6 libraries were included in the app code) [#1823](https://github.com/rails/webpacker/pull/1823).
|
200
255
|
|
201
|
-
|
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).
|
202
257
|
|
203
|
-
|
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.
|
204
259
|
|
205
|
-
|
260
|
+
To keep previous behavior, remove `nodeModules` loader specifying `environment.loaders.delete('nodeModules');` in your `config/webpack/environment.js` file.
|
206
261
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
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
|
+
```
|
214
270
|
|
215
271
|
### Added
|
216
272
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
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)
|
228
288
|
|
229
289
|
## [4.0.0-pre.3] - 2018-10-01
|
230
290
|
|
231
291
|
### Added
|
232
292
|
|
233
|
-
|
293
|
+
- Move supported browsers configuration to [.browserslistrc](https://github.com/browserslist/browserslist#queries)
|
234
294
|
|
235
295
|
### Breaking changes
|
236
296
|
|
237
|
-
|
238
|
-
|
297
|
+
- postcss-next is replaced with postcss-preset-env
|
298
|
+
- babel@7
|
239
299
|
|
240
300
|
### Fixed
|
241
301
|
|
242
|
-
|
302
|
+
- Bring back test env [#1563](https://github.com/rails/webpacker/pull/1563)
|
243
303
|
|
244
304
|
Please see a list of [commits](https://github.com/rails/webpacker/compare/2dd68f0273074aadb3f869c4c30369d5e4e3fea7...master)
|
245
305
|
|
@@ -249,36 +309,82 @@ Please see a list of [commits](https://github.com/rails/webpacker/compare/2dd68f
|
|
249
309
|
|
250
310
|
- Webpack dev server version in installer
|
251
311
|
|
252
|
-
|
253
312
|
## [4.0.0-pre.1] - 2018-04-2
|
254
313
|
|
255
314
|
Pre-release to try out webpack 4.0 support
|
256
315
|
|
257
316
|
### Added
|
258
|
-
|
317
|
+
|
318
|
+
- Webpack 4.0 support [#1376](https://github.com/rails/webpacker/pull/1316)
|
319
|
+
|
320
|
+
### Fixed
|
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
|
327
|
+
|
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
|
259
337
|
|
260
338
|
### Fixed
|
261
|
-
- Remove compilation digest file if webpack command fails[#1398](https://github.com/rails/webpacker/issues/1398)
|
262
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)
|
263
364
|
|
264
|
-
|
265
|
-
|
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)
|
266
372
|
|
267
373
|
## [3.4.1] - 2018-03-24
|
268
374
|
|
269
375
|
### Fixed
|
270
|
-
- Yarn integrity check in development [#1374](https://github.com/rails/webpacker/issues/1374)
|
271
376
|
|
377
|
+
- Yarn integrity check in development [#1374](https://github.com/rails/webpacker/issues/1374)
|
272
378
|
|
273
379
|
## [3.4.0] - 2018-03-23
|
274
380
|
|
275
381
|
**Please use 3.4.1 instead**
|
276
382
|
|
277
383
|
### Added
|
278
|
-
- Support for custom Rails environments [#1359](https://github.com/rails/webpacker/pull/1359)
|
279
384
|
|
280
|
-
|
385
|
+
- Support for custom Rails environments [#1359](https://github.com/rails/webpacker/pull/1359)
|
281
386
|
|
387
|
+
_This could break the compilation if you set NODE_ENV to custom environment. Now, NODE_ENV only understands production or development mode_
|
282
388
|
|
283
389
|
## [3.3.1] - 2018-03-12
|
284
390
|
|
@@ -301,6 +407,7 @@ for further releases and changelogs:
|
|
301
407
|
```
|
302
408
|
bundle exec rails webpacker:binstubs
|
303
409
|
```
|
410
|
+
|
304
411
|
- set function is now removed from plugins and loaders, please use `append` or `prepend`
|
305
412
|
|
306
413
|
```js
|
@@ -314,6 +421,7 @@ environment.loaders.append('json', {
|
|
314
421
|
```
|
315
422
|
|
316
423
|
### Fixed
|
424
|
+
|
317
425
|
- Limit ts-loader to 3.5.0 until webpack 4 support [#1308](https://github.com/rails/webpacker/pull/1308)
|
318
426
|
- Custom env support [#1304](https://github.com/rails/webpacker/pull/1304)
|
319
427
|
|
@@ -347,7 +455,6 @@ And, bunch of bug fixes [See changes](https://github.com/rails/webpacker/compare
|
|
347
455
|
|
348
456
|
- Revert file loader [#1196](https://github.com/rails/webpacker/pull/1196)
|
349
457
|
|
350
|
-
|
351
458
|
## [3.2.0] - 2017-12-16
|
352
459
|
|
353
460
|
### To upgrade:
|
@@ -377,11 +484,11 @@ into your `config/webpack/loaders/`
|
|
377
484
|
directory and add it to webpack build from `config/webpack/environment.js`
|
378
485
|
|
379
486
|
```js
|
380
|
-
const erb =
|
381
|
-
const elm =
|
382
|
-
const typescript =
|
383
|
-
const vue =
|
384
|
-
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')
|
385
492
|
|
386
493
|
environment.loaders.append('coffee', coffee)
|
387
494
|
environment.loaders.append('vue', vue)
|
@@ -404,19 +511,16 @@ plugins:
|
|
404
511
|
|
405
512
|
- `postcss-import` in place of `postcss-smart-import`
|
406
513
|
|
407
|
-
|
408
514
|
### Removed (npm module)
|
409
515
|
|
410
516
|
- `postcss-smart-import`, `coffee-loader`, `url-loader`, `rails-erb-loader` as dependencies
|
411
517
|
|
412
|
-
-
|
413
|
-
|
518
|
+
- `publicPath` from file loader [#1107](https://github.com/rails/webpacker/pull/1107)
|
414
519
|
|
415
520
|
### Fixed (npm module)
|
416
521
|
|
417
522
|
- Return native array type for `ConfigList` [#1098](https://github.com/rails/webpacker/pull/1098)
|
418
523
|
|
419
|
-
|
420
524
|
### Added (Gem)
|
421
525
|
|
422
526
|
- New `asset_pack_url` helper [#1102](https://github.com/rails/webpacker/pull/1102)
|
@@ -430,17 +534,14 @@ bundle exec rails webpacker:install:coffee
|
|
430
534
|
|
431
535
|
- Resolved paths from webpacker.yml to compiler watched list
|
432
536
|
|
433
|
-
|
434
537
|
## [3.1.1] - 2017-12-11
|
435
538
|
|
436
539
|
### Fixed
|
437
540
|
|
438
541
|
- Include default webpacker.yml config inside npm package
|
439
542
|
|
440
|
-
|
441
543
|
## [3.1.0] - 2017-12-11
|
442
544
|
|
443
|
-
|
444
545
|
### Added (npm module)
|
445
546
|
|
446
547
|
- Expose base config from environment
|
@@ -450,7 +551,8 @@ environment.config.set('resolve.extensions', ['.foo', '.bar'])
|
|
450
551
|
environment.config.set('output.filename', '[name].js')
|
451
552
|
environment.config.delete('output.chunkFilename')
|
452
553
|
environment.config.get('resolve')
|
453
|
-
environment.config.merge({
|
554
|
+
environment.config.merge({
|
555
|
+
output: {
|
454
556
|
filename: '[name].js'
|
455
557
|
}
|
456
558
|
})
|
@@ -459,7 +561,7 @@ environment.config.merge({ output: {
|
|
459
561
|
- Expose new API's for loaders and plugins to insert at position
|
460
562
|
|
461
563
|
```js
|
462
|
-
const jsonLoader =
|
564
|
+
const jsonLoader = {
|
463
565
|
test: /\.json$/,
|
464
566
|
exclude: /node_modules/,
|
465
567
|
loader: 'json-loader'
|
@@ -467,8 +569,8 @@ const jsonLoader = {
|
|
467
569
|
|
468
570
|
environment.loaders.append('json', jsonLoader)
|
469
571
|
environment.loaders.prepend('json', jsonLoader)
|
470
|
-
environment.loaders.insert('json', jsonLoader, { after: 'style' }
|
471
|
-
environment.loaders.insert('json', jsonLoader, { before: 'babel' }
|
572
|
+
environment.loaders.insert('json', jsonLoader, { after: 'style' })
|
573
|
+
environment.loaders.insert('json', jsonLoader, { before: 'babel' })
|
472
574
|
|
473
575
|
// Update a plugin
|
474
576
|
const manifestPlugin = environment.plugins.get('Manifest')
|
@@ -476,10 +578,14 @@ manifestPlugin.opts.writeToFileEmit = false
|
|
476
578
|
|
477
579
|
// Update coffee loader to use coffeescript 2
|
478
580
|
const babelLoader = environment.loaders.get('babel')
|
479
|
-
environment.loaders.insert(
|
480
|
-
|
481
|
-
|
482
|
-
|
581
|
+
environment.loaders.insert(
|
582
|
+
'coffee',
|
583
|
+
{
|
584
|
+
test: /\.coffee(\.erb)?$/,
|
585
|
+
use: babelLoader.use.concat(['coffee-loader'])
|
586
|
+
},
|
587
|
+
{ before: 'json' }
|
588
|
+
)
|
483
589
|
```
|
484
590
|
|
485
591
|
- Expose `resolve.modules` paths like loaders and plugins
|
@@ -491,8 +597,8 @@ environment.resolvedModules.append('vendor', 'vendor')
|
|
491
597
|
- Enable sourcemaps in `style` and `css` loader
|
492
598
|
|
493
599
|
- Separate `css` and `sass` loader for easier configuration. `style` loader is now
|
494
|
-
`css` loader, which resolves `.css` files and `sass` loader resolves `.scss` and `.sass`
|
495
|
-
files.
|
600
|
+
`css` loader, which resolves `.css` files and `sass` loader resolves `.scss` and `.sass`
|
601
|
+
files.
|
496
602
|
|
497
603
|
```js
|
498
604
|
// Enable css modules with sass loader
|
@@ -528,7 +634,6 @@ dev_server:
|
|
528
634
|
|
529
635
|
- Add url loader to process and embed smaller static files
|
530
636
|
|
531
|
-
|
532
637
|
### Removed
|
533
638
|
|
534
639
|
- resolve url loader [#1042](https://github.com/rails/webpacker/issues/1042)
|
@@ -545,8 +650,7 @@ WEBPACKER_PRECOMPILE=false bundle exec rails assets:precompile
|
|
545
650
|
- Use `WEBPACKER_ASSET_HOST` instead of `ASSET_HOST` for CDN
|
546
651
|
|
547
652
|
- Alias `webpacker:compile` task to `assets:precompile` if is not defined so it works
|
548
|
-
without sprockets
|
549
|
-
|
653
|
+
without sprockets
|
550
654
|
|
551
655
|
## [3.0.2] - 2017-10-04
|
552
656
|
|
@@ -581,7 +685,7 @@ Webpacker.manifest.lookup!('foo.js')
|
|
581
685
|
- Inline CLI args for dev server binstub, use env variables instead
|
582
686
|
|
583
687
|
- Coffeescript as core dependency. You have to manually add coffeescript now, if you are using
|
584
|
-
it in your app.
|
688
|
+
it in your app.
|
585
689
|
|
586
690
|
```bash
|
587
691
|
yarn add coffeescript@1.12.7
|
@@ -613,8 +717,7 @@ yarn add coffeescript
|
|
613
717
|
### Removed
|
614
718
|
|
615
719
|
- `watchContentBase` from devServer config so it doesn't unncessarily trigger
|
616
|
-
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.
|
617
|
-
|
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.
|
618
721
|
|
619
722
|
## [3.0.0] - 2017-08-30
|
620
723
|
|
@@ -623,9 +726,9 @@ live reload when manifest changes. If you have applied this workaround from [#72
|
|
623
726
|
- `resolved_paths` option to allow adding additional paths webpack should lookup when resolving modules
|
624
727
|
|
625
728
|
```yml
|
626
|
-
|
627
|
-
|
628
|
-
|
729
|
+
# config/webpacker.yml
|
730
|
+
# Additional paths webpack should lookup modules
|
731
|
+
resolved_paths: [] # empty by default
|
629
732
|
```
|
630
733
|
|
631
734
|
- `Webpacker::Compiler.fresh?` and `Webpacker::Compiler.stale?` answer the question of whether compilation is needed.
|
@@ -678,8 +781,8 @@ live reload when manifest changes. If you have applied this workaround from [#72
|
|
678
781
|
- Serve assets using `localhost` from dev server - [#424](https://github.com/rails/webpacker/issues/424)
|
679
782
|
|
680
783
|
```yml
|
681
|
-
|
682
|
-
|
784
|
+
dev_server:
|
785
|
+
host: localhost
|
683
786
|
```
|
684
787
|
|
685
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)
|
@@ -689,21 +792,21 @@ live reload when manifest changes. If you have applied this workaround from [#72
|
|
689
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`:
|
690
793
|
|
691
794
|
```yaml
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
795
|
+
default: &default
|
796
|
+
cache_path: tmp/cache/webpacker
|
797
|
+
test:
|
798
|
+
compile: true
|
696
799
|
|
697
|
-
|
698
|
-
|
800
|
+
development:
|
801
|
+
compile: true
|
699
802
|
|
700
|
-
|
701
|
-
|
803
|
+
production:
|
804
|
+
compile: false
|
702
805
|
```
|
703
806
|
|
704
807
|
- Make test compilation cacheable and configurable so that the lazy compilation
|
705
|
-
only triggers if files are changed under tracked paths.
|
706
|
-
Following paths are watched by default -
|
808
|
+
only triggers if files are changed under tracked paths.
|
809
|
+
Following paths are watched by default -
|
707
810
|
|
708
811
|
```rb
|
709
812
|
["app/javascript/**/*", "yarn.lock", "package.json", "config/webpack/**/*"]
|
@@ -719,6 +822,7 @@ Following paths are watched by default -
|
|
719
822
|
## [2.0] - 2017-05-24
|
720
823
|
|
721
824
|
### Fixed
|
825
|
+
|
722
826
|
- Update `.babelrc` to fix compilation issues - [#306](https://github.com/rails/webpacker/issues/306)
|
723
827
|
|
724
828
|
- Duplicated asset hosts - [#320](https://github.com/rails/webpacker/issues/320), [#397](https://github.com/rails/webpacker/pull/397)
|
@@ -731,24 +835,28 @@ Following paths are watched by default -
|
|
731
835
|
|
732
836
|
- ARGV support for `webpack-dev-server` - [#286](https://github.com/rails/webpacker/issues/286)
|
733
837
|
|
734
|
-
|
735
838
|
### Added
|
839
|
+
|
736
840
|
- [Elm](http://elm-lang.org) support. You can now add Elm support via the following methods:
|
841
|
+
|
737
842
|
- New app: `rails new <app> --webpack=elm`
|
738
843
|
- Within an existing app: `rails webpacker:install:elm`
|
739
844
|
|
740
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)
|
741
846
|
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
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
|
+
```
|
752
860
|
|
753
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)
|
754
862
|
|
@@ -757,26 +865,29 @@ Following paths are watched by default -
|
|
757
865
|
```json
|
758
866
|
{
|
759
867
|
"presets": [
|
760
|
-
[
|
761
|
-
"
|
762
|
-
|
763
|
-
"
|
764
|
-
"
|
765
|
-
|
766
|
-
|
767
|
-
|
868
|
+
[
|
869
|
+
"env",
|
870
|
+
{
|
871
|
+
"modules": false,
|
872
|
+
"targets": {
|
873
|
+
"browsers": "> 1%",
|
874
|
+
"uglify": true
|
875
|
+
},
|
876
|
+
"useBuiltIns": true
|
877
|
+
}
|
878
|
+
]
|
768
879
|
],
|
769
880
|
|
770
881
|
"plugins": [
|
771
882
|
"syntax-dynamic-import",
|
772
|
-
"transform-class-properties",
|
883
|
+
"transform-class-properties",
|
884
|
+
{ "spec": true }
|
773
885
|
]
|
774
886
|
}
|
775
887
|
```
|
776
888
|
|
777
889
|
- Source-map support for production bundle
|
778
890
|
|
779
|
-
|
780
891
|
#### Breaking Change
|
781
892
|
|
782
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.
|
@@ -791,14 +902,16 @@ Following paths are watched by default -
|
|
791
902
|
rm config/webpack/development.server.js
|
792
903
|
```
|
793
904
|
|
794
|
-
|
905
|
+
**Warning**: For now you also have to add a pattern in `.gitignore` by hand.
|
906
|
+
|
795
907
|
```diff
|
796
908
|
/public/packs
|
797
909
|
+/public/packs-test
|
798
910
|
/node_modules
|
799
|
-
|
911
|
+
```
|
800
912
|
|
801
913
|
## [1.2] - 2017-04-27
|
914
|
+
|
802
915
|
Some of the changes made requires you to run below commands to install new changes.
|
803
916
|
|
804
917
|
```
|
@@ -806,13 +919,14 @@ bundle update webpacker
|
|
806
919
|
bundle exec rails webpacker:install
|
807
920
|
```
|
808
921
|
|
809
|
-
|
810
922
|
### Fixed
|
923
|
+
|
811
924
|
- Support Spring - [#205](https://github.com/rails/webpacker/issues/205)
|
812
925
|
|
813
926
|
```ruby
|
814
927
|
Spring.after_fork { Webpacker.bootstrap } if defined?(Spring)
|
815
928
|
```
|
929
|
+
|
816
930
|
- Check node version and yarn before installing webpacker - [#217](https://github.com/rails/webpacker/issues/217)
|
817
931
|
|
818
932
|
- Include webpacker helper to views - [#172](https://github.com/rails/webpacker/issues/172)
|
@@ -825,27 +939,28 @@ bundle exec rails webpacker:install
|
|
825
939
|
|
826
940
|
- Move babel presets and plugins to .babelrc - [#202](https://github.com/rails/webpacker/issues/202)
|
827
941
|
|
828
|
-
|
829
942
|
### Added
|
943
|
+
|
830
944
|
- A changelog - [#211](https://github.com/rails/webpacker/issues/211)
|
831
945
|
- Minimize CSS assets - [#218](https://github.com/rails/webpacker/issues/218)
|
832
946
|
- Pack namespacing support - [#201](https://github.com/rails/webpacker/pull/201)
|
833
947
|
|
834
948
|
For example:
|
949
|
+
|
835
950
|
```
|
836
951
|
app/javascript/packs/admin/hello_vue.js
|
837
952
|
app/javascript/packs/admin/hello.vue
|
838
953
|
app/javascript/packs/hello_vue.js
|
839
954
|
app/javascript/packs/hello.vue
|
840
955
|
```
|
956
|
+
|
841
957
|
- Add tree-shaking support - [#250](https://github.com/rails/webpacker/pull/250)
|
842
958
|
- Add initial test case by @kimquy [#259](https://github.com/rails/webpacker/pull/259)
|
843
959
|
- Compile assets before test:controllers and test:system
|
844
960
|
|
845
|
-
|
846
961
|
### Removed
|
847
|
-
- Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)
|
848
962
|
|
963
|
+
- Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)
|
849
964
|
|
850
965
|
## [1.1] - 2017-03-24
|
851
966
|
|
@@ -860,10 +975,10 @@ bundle exec rails webpacker:install:[react, angular, vue]
|
|
860
975
|
```
|
861
976
|
|
862
977
|
### Added (breaking changes)
|
978
|
+
|
863
979
|
- Static assets support - [#153](https://github.com/rails/webpacker/pull/153)
|
864
980
|
- Advanced webpack configuration - [#153](https://github.com/rails/webpacker/pull/153)
|
865
981
|
|
866
|
-
|
867
982
|
### Removed
|
868
983
|
|
869
984
|
```rb
|