webpacker 4.1.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -54
- data/Gemfile.lock +1 -1
- data/lib/webpacker/env.rb +1 -1
- data/lib/webpacker/railtie.rb +3 -1
- data/lib/webpacker/version.rb +1 -1
- data/package.json +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bcfdcad6251b8aaa5e5687a3f16b498faf3ca8aae0615fddf75113194031eed
|
4
|
+
data.tar.gz: 97acb9d68194424e88e9818e91c07e6b9289f42540ca11f35be4f51899b320c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a35dae1dd158f276296a7b23c8f2ea5243e30ed779fd8295e52b7a00a184dfad71b1e811101e183a8798a32c329ddc89881f6206b00ffcd2ce33941be060568
|
7
|
+
data.tar.gz: 7fbc1d41d61b2b11aab7dd47859d2b407fc7617f0e2eee177ea2178c21dfdb25884017bb61b144aa55112241644bdbb4e2ca1c81b98ee41ff9b1ab7d93bdddbf
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
**Please note that Webpacker 3.1.0 and 3.1.1 have some serious bugs so please consider using either 3.0.2 or 3.2.0**
|
2
2
|
|
3
|
+
**Please note that Webpacker 4.1.0 has an installer bug. Please use 4.2.0 or above**
|
4
|
+
|
5
|
+
## [[4.2.0]](https://github.com/rails/webpacker/compare/v4.1.0...v4.2.0) - 2019-11-12
|
6
|
+
|
7
|
+
- Fixed installer bug [#2366](https://github.com/rails/webpacker/pull/2366)
|
8
|
+
|
3
9
|
## [[4.1.0]](https://github.com/rails/webpacker/compare/v4.0.7...v4.1.0) - 2019-11-12
|
4
10
|
|
5
11
|
- Added favicon_pack_tag to generate favicon links [#2281](https://github.com/rails/webpacker/pull/2281)
|
@@ -43,14 +49,14 @@ Please see the diff
|
|
43
49
|
In each of your `/packs/*.js` files, change this:
|
44
50
|
|
45
51
|
```js
|
46
|
-
import
|
52
|
+
import "@babel/polyfill";
|
47
53
|
```
|
48
54
|
|
49
55
|
to this:
|
50
56
|
|
51
57
|
```js
|
52
|
-
import
|
53
|
-
import
|
58
|
+
import "core-js/stable";
|
59
|
+
import "regenerator-runtime/runtime";
|
54
60
|
```
|
55
61
|
|
56
62
|
Don't forget to install those dependencies directly!
|
@@ -87,10 +93,10 @@ Source maps can be disabled in any environment configuration, e.g:
|
|
87
93
|
```js
|
88
94
|
// config/webpack/production.js
|
89
95
|
|
90
|
-
const environment = require(
|
91
|
-
environment.config.merge({ devtool:
|
96
|
+
const environment = require("./environment");
|
97
|
+
environment.config.merge({ devtool: "none" });
|
92
98
|
|
93
|
-
module.exports = environment.toWebpackConfig()
|
99
|
+
module.exports = environment.toWebpackConfig();
|
94
100
|
```
|
95
101
|
|
96
102
|
- Reintroduced `context` to the file loader. Reverting the simpler paths change
|
@@ -141,12 +147,12 @@ To get old behaviour:
|
|
141
147
|
```js
|
142
148
|
// config/webpack/environment.js
|
143
149
|
|
144
|
-
const { environment, config } = require(
|
145
|
-
const { join } = require(
|
150
|
+
const { environment, config } = require("@rails/webpacker");
|
151
|
+
const { join } = require("path");
|
146
152
|
|
147
|
-
const fileLoader = environment.loaders.get(
|
148
|
-
fileLoader.use[0].options.name =
|
149
|
-
fileLoader.use[0].options.context = join(config.source_path) // optional if you don't want to expose full paths
|
153
|
+
const fileLoader = environment.loaders.get("file");
|
154
|
+
fileLoader.use[0].options.name = "[path][name]-[hash].[ext]";
|
155
|
+
fileLoader.use[0].options.context = join(config.source_path); // optional if you don't want to expose full paths
|
150
156
|
```
|
151
157
|
|
152
158
|
### Added
|
@@ -240,7 +246,7 @@ helper otherwise you will get duplicated chunks on the page.
|
|
240
246
|
depending on how you want to process packs [#1823](https://github.com/rails/webpacker/pull/1823)
|
241
247
|
|
242
248
|
```js
|
243
|
-
environment.loaders.prepend()
|
249
|
+
environment.loaders.prepend();
|
244
250
|
```
|
245
251
|
|
246
252
|
- Separate CSS extraction from build environment [#1625](https://github.com/rails/webpacker/pull/1625)
|
@@ -275,13 +281,13 @@ static_assets_extensions:
|
|
275
281
|
- Add split chunks api (undocumented)
|
276
282
|
|
277
283
|
```js
|
278
|
-
const { environment } = require(
|
284
|
+
const { environment } = require("@rails/webpacker");
|
279
285
|
// Enable with default config
|
280
|
-
environment.splitChunks()
|
286
|
+
environment.splitChunks();
|
281
287
|
// Configure via a callback
|
282
288
|
environment.splitChunks(config =>
|
283
289
|
Object.assign({}, config, { optimization: { splitChunks: false } })
|
284
|
-
)
|
290
|
+
);
|
285
291
|
```
|
286
292
|
|
287
293
|
- Allow changing static file extensions using webpacker.yml (undocumented)
|
@@ -412,12 +418,12 @@ bundle exec rails webpacker:binstubs
|
|
412
418
|
|
413
419
|
```js
|
414
420
|
// config/webpack/environment.js
|
415
|
-
const { environment } = require(
|
421
|
+
const { environment } = require("@rails/webpacker");
|
416
422
|
|
417
|
-
environment.loaders.append(
|
423
|
+
environment.loaders.append("json", {
|
418
424
|
test: /\.json$/,
|
419
|
-
use:
|
420
|
-
})
|
425
|
+
use: "json-loader"
|
426
|
+
});
|
421
427
|
```
|
422
428
|
|
423
429
|
### Fixed
|
@@ -484,17 +490,17 @@ into your `config/webpack/loaders/`
|
|
484
490
|
directory and add it to webpack build from `config/webpack/environment.js`
|
485
491
|
|
486
492
|
```js
|
487
|
-
const erb = require(
|
488
|
-
const elm = require(
|
489
|
-
const typescript = require(
|
490
|
-
const vue = require(
|
491
|
-
const coffee = require(
|
493
|
+
const erb = require("./loaders/erb");
|
494
|
+
const elm = require("./loaders/elm");
|
495
|
+
const typescript = require("./loaders/typescript");
|
496
|
+
const vue = require("./loaders/vue");
|
497
|
+
const coffee = require("./loaders/coffee");
|
492
498
|
|
493
|
-
environment.loaders.append(
|
494
|
-
environment.loaders.append(
|
495
|
-
environment.loaders.append(
|
496
|
-
environment.loaders.append(
|
497
|
-
environment.loaders.append(
|
499
|
+
environment.loaders.append("coffee", coffee);
|
500
|
+
environment.loaders.append("vue", vue);
|
501
|
+
environment.loaders.append("typescript", typescript);
|
502
|
+
environment.loaders.append("elm", elm);
|
503
|
+
environment.loaders.append("erb", erb);
|
498
504
|
```
|
499
505
|
|
500
506
|
In `.postcssrc.yml` you need to change the plugin name from `postcss-smart-import` to `postcss-import`:
|
@@ -547,15 +553,15 @@ bundle exec rails webpacker:install:coffee
|
|
547
553
|
- Expose base config from environment
|
548
554
|
|
549
555
|
```js
|
550
|
-
environment.config.set(
|
551
|
-
environment.config.set(
|
552
|
-
environment.config.delete(
|
553
|
-
environment.config.get(
|
556
|
+
environment.config.set("resolve.extensions", [".foo", ".bar"]);
|
557
|
+
environment.config.set("output.filename", "[name].js");
|
558
|
+
environment.config.delete("output.chunkFilename");
|
559
|
+
environment.config.get("resolve");
|
554
560
|
environment.config.merge({
|
555
561
|
output: {
|
556
|
-
filename:
|
562
|
+
filename: "[name].js"
|
557
563
|
}
|
558
|
-
})
|
564
|
+
});
|
559
565
|
```
|
560
566
|
|
561
567
|
- Expose new API's for loaders and plugins to insert at position
|
@@ -564,34 +570,34 @@ environment.config.merge({
|
|
564
570
|
const jsonLoader = {
|
565
571
|
test: /\.json$/,
|
566
572
|
exclude: /node_modules/,
|
567
|
-
loader:
|
568
|
-
}
|
573
|
+
loader: "json-loader"
|
574
|
+
};
|
569
575
|
|
570
|
-
environment.loaders.append(
|
571
|
-
environment.loaders.prepend(
|
572
|
-
environment.loaders.insert(
|
573
|
-
environment.loaders.insert(
|
576
|
+
environment.loaders.append("json", jsonLoader);
|
577
|
+
environment.loaders.prepend("json", jsonLoader);
|
578
|
+
environment.loaders.insert("json", jsonLoader, { after: "style" });
|
579
|
+
environment.loaders.insert("json", jsonLoader, { before: "babel" });
|
574
580
|
|
575
581
|
// Update a plugin
|
576
|
-
const manifestPlugin = environment.plugins.get(
|
577
|
-
manifestPlugin.opts.writeToFileEmit = false
|
582
|
+
const manifestPlugin = environment.plugins.get("Manifest");
|
583
|
+
manifestPlugin.opts.writeToFileEmit = false;
|
578
584
|
|
579
585
|
// Update coffee loader to use coffeescript 2
|
580
|
-
const babelLoader = environment.loaders.get(
|
586
|
+
const babelLoader = environment.loaders.get("babel");
|
581
587
|
environment.loaders.insert(
|
582
|
-
|
588
|
+
"coffee",
|
583
589
|
{
|
584
590
|
test: /\.coffee(\.erb)?$/,
|
585
|
-
use: babelLoader.use.concat([
|
591
|
+
use: babelLoader.use.concat(["coffee-loader"])
|
586
592
|
},
|
587
|
-
{ before:
|
588
|
-
)
|
593
|
+
{ before: "json" }
|
594
|
+
);
|
589
595
|
```
|
590
596
|
|
591
597
|
- Expose `resolve.modules` paths like loaders and plugins
|
592
598
|
|
593
599
|
```js
|
594
|
-
environment.resolvedModules.append(
|
600
|
+
environment.resolvedModules.append("vendor", "vendor");
|
595
601
|
```
|
596
602
|
|
597
603
|
- Enable sourcemaps in `style` and `css` loader
|
@@ -602,13 +608,13 @@ environment.resolvedModules.append('vendor', 'vendor')
|
|
602
608
|
|
603
609
|
```js
|
604
610
|
// Enable css modules with sass loader
|
605
|
-
const sassLoader = environment.loaders.get(
|
606
|
-
const cssLoader = sassLoader.use.find(loader => loader.loader ===
|
611
|
+
const sassLoader = environment.loaders.get("sass");
|
612
|
+
const cssLoader = sassLoader.use.find(loader => loader.loader === "css-loader");
|
607
613
|
|
608
614
|
cssLoader.options = Object.assign({}, cssLoader.options, {
|
609
615
|
modules: true,
|
610
|
-
localIdentName:
|
611
|
-
})
|
616
|
+
localIdentName: "[path][name]__[local]--[hash:base64:5]"
|
617
|
+
});
|
612
618
|
```
|
613
619
|
|
614
620
|
- Expose rest of configurable dev server options from webpacker.yml
|
@@ -616,7 +622,7 @@ cssLoader.options = Object.assign({}, cssLoader.options, {
|
|
616
622
|
```yml
|
617
623
|
quiet: false
|
618
624
|
headers:
|
619
|
-
|
625
|
+
"Access-Control-Allow-Origin": "*"
|
620
626
|
watch_options:
|
621
627
|
ignored: /node_modules/
|
622
628
|
```
|
data/Gemfile.lock
CHANGED
data/lib/webpacker/env.rb
CHANGED
data/lib/webpacker/railtie.rb
CHANGED
@@ -91,6 +91,8 @@ class Webpacker::Engine < ::Rails::Engine
|
|
91
91
|
end
|
92
92
|
|
93
93
|
initializer "webpacker.set_source" do |app|
|
94
|
-
|
94
|
+
if Webpacker.config.config_path.exist?
|
95
|
+
app.config.javascript_path = Webpacker.config.source_path.relative_path_from(Rails.root.join("app")).to_s
|
96
|
+
end
|
95
97
|
end
|
96
98
|
end
|
data/lib/webpacker/version.rb
CHANGED
data/package.json
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpacker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
@@ -287,8 +287,8 @@ homepage: https://github.com/rails/webpacker
|
|
287
287
|
licenses:
|
288
288
|
- MIT
|
289
289
|
metadata:
|
290
|
-
source_code_uri: https://github.com/rails/webpacker/tree/v4.
|
291
|
-
changelog_uri: https://github.com/rails/webpacker/blob/v4.
|
290
|
+
source_code_uri: https://github.com/rails/webpacker/tree/v4.2.0
|
291
|
+
changelog_uri: https://github.com/rails/webpacker/blob/v4.2.0/CHANGELOG.md
|
292
292
|
post_install_message:
|
293
293
|
rdoc_options: []
|
294
294
|
require_paths:
|