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