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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f963229e216d0bca7d8df5465f22b533717bc8be3adf863741a192c7861e973
4
- data.tar.gz: 629616f4cdd093022317961b93e5aa1af05f6ac76c838f4a1ee9f3572a40ef84
3
+ metadata.gz: 4bcfdcad6251b8aaa5e5687a3f16b498faf3ca8aae0615fddf75113194031eed
4
+ data.tar.gz: 97acb9d68194424e88e9818e91c07e6b9289f42540ca11f35be4f51899b320c0
5
5
  SHA512:
6
- metadata.gz: ea84ec0b04b8bc519e4cfe2ba0d15c232f14d41995874da3b0faa0397597d62e184c5b9e726e95c73a15a05baf4d89feef1e47081b1bd6ccb9e2139fb85cc01a
7
- data.tar.gz: 5209c618fdf30b3e9b39277a672fa97d8b941d31defa973ae8467f1e5daea03e5dfc1af128d65cd4a40ed41be091f8a222929782a044bba6f2f8934c53c4a8b3
6
+ metadata.gz: 3a35dae1dd158f276296a7b23c8f2ea5243e30ed779fd8295e52b7a00a184dfad71b1e811101e183a8798a32c329ddc89881f6206b00ffcd2ce33941be060568
7
+ data.tar.gz: 7fbc1d41d61b2b11aab7dd47859d2b407fc7617f0e2eee177ea2178c21dfdb25884017bb61b144aa55112241644bdbb4e2ca1c81b98ee41ff9b1ab7d93bdddbf
@@ -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 '@babel/polyfill'
52
+ import "@babel/polyfill";
47
53
  ```
48
54
 
49
55
  to this:
50
56
 
51
57
  ```js
52
- import 'core-js/stable'
53
- import 'regenerator-runtime/runtime'
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('./environment')
91
- environment.config.merge({ devtool: 'none' })
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('@rails/webpacker')
145
- const { join } = require('path')
150
+ const { environment, config } = require("@rails/webpacker");
151
+ const { join } = require("path");
146
152
 
147
- const fileLoader = environment.loaders.get('file')
148
- fileLoader.use[0].options.name = '[path][name]-[hash].[ext]'
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('@rails/webpacker')
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('@rails/webpacker')
421
+ const { environment } = require("@rails/webpacker");
416
422
 
417
- environment.loaders.append('json', {
423
+ environment.loaders.append("json", {
418
424
  test: /\.json$/,
419
- use: 'json-loader'
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('./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')
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('coffee', coffee)
494
- environment.loaders.append('vue', vue)
495
- environment.loaders.append('typescript', typescript)
496
- environment.loaders.append('elm', elm)
497
- environment.loaders.append('erb', erb)
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('resolve.extensions', ['.foo', '.bar'])
551
- environment.config.set('output.filename', '[name].js')
552
- environment.config.delete('output.chunkFilename')
553
- environment.config.get('resolve')
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: '[name].js'
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: 'json-loader'
568
- }
573
+ loader: "json-loader"
574
+ };
569
575
 
570
- environment.loaders.append('json', jsonLoader)
571
- environment.loaders.prepend('json', jsonLoader)
572
- environment.loaders.insert('json', jsonLoader, { after: 'style' })
573
- environment.loaders.insert('json', jsonLoader, { before: 'babel' })
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('Manifest')
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('babel')
586
+ const babelLoader = environment.loaders.get("babel");
581
587
  environment.loaders.insert(
582
- 'coffee',
588
+ "coffee",
583
589
  {
584
590
  test: /\.coffee(\.erb)?$/,
585
- use: babelLoader.use.concat(['coffee-loader'])
591
+ use: babelLoader.use.concat(["coffee-loader"])
586
592
  },
587
- { before: 'json' }
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('vendor', 'vendor')
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('sass')
606
- const cssLoader = sassLoader.use.find(loader => loader.loader === 'css-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: '[path][name]__[local]--[hash:base64:5]'
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
- 'Access-Control-Allow-Origin': '*'
625
+ "Access-Control-Allow-Origin": "*"
620
626
  watch_options:
621
627
  ignored: /node_modules/
622
628
  ```
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- webpacker (4.1.0)
4
+ webpacker (4.2.0)
5
5
  activesupport (>= 4.2)
6
6
  rack-proxy (>= 0.6.1)
7
7
  railties (>= 4.2)
@@ -12,7 +12,7 @@ class Webpacker::Env
12
12
  end
13
13
 
14
14
  def inquire
15
- fallback_env_warning unless current
15
+ fallback_env_warning if config_path.exist? && !current
16
16
  current || DEFAULT.inquiry
17
17
  end
18
18
 
@@ -91,6 +91,8 @@ class Webpacker::Engine < ::Rails::Engine
91
91
  end
92
92
 
93
93
  initializer "webpacker.set_source" do |app|
94
- app.config.javascript_path = Webpacker.config.source_path.relative_path_from(Rails.root.join("app")).to_s
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
@@ -1,4 +1,4 @@
1
1
  module Webpacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "4.1.0".freeze
3
+ VERSION = "4.2.0".freeze
4
4
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rails/webpacker",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "Use webpack to manage app-like JavaScript modules in Rails",
5
5
  "main": "package/index.js",
6
6
  "files": [
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.1.0
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.1.0
291
- changelog_uri: https://github.com/rails/webpacker/blob/v4.1.0/CHANGELOG.md
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: