webpacker 4.0.0.pre.pre.2 → 4.0.0.pre.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.node-version +1 -0
  3. data/.travis.yml +4 -0
  4. data/CHANGELOG.md +22 -2
  5. data/Gemfile.lock +63 -53
  6. data/README.md +39 -23
  7. data/Rakefile +1 -2
  8. data/docs/cloud9.md +1 -1
  9. data/docs/css.md +1 -1
  10. data/docs/es6.md +4 -4
  11. data/docs/testing.md +1 -1
  12. data/docs/webpack.md +4 -0
  13. data/gemfiles/Gemfile-rails.4.2.x +1 -1
  14. data/gemfiles/Gemfile-rails.5.0.x +1 -1
  15. data/gemfiles/Gemfile-rails.5.1.x +1 -1
  16. data/gemfiles/Gemfile-rails.5.2.x +10 -0
  17. data/lib/install/angular.rb +2 -2
  18. data/lib/install/bin/webpack +6 -2
  19. data/lib/install/bin/webpack-dev-server +6 -2
  20. data/lib/install/coffee.rb +1 -1
  21. data/lib/install/config/.babelrc +35 -12
  22. data/lib/install/config/.browserslistrc +1 -0
  23. data/lib/install/config/.postcssrc.yml +1 -1
  24. data/lib/install/config/webpacker.yml +4 -0
  25. data/lib/install/elm.rb +5 -4
  26. data/lib/install/erb.rb +1 -1
  27. data/lib/install/examples/react/.babelrc +43 -2
  28. data/lib/install/examples/stimulus/application.js +1 -6
  29. data/lib/install/examples/stimulus/controllers/index.js +9 -0
  30. data/lib/install/examples/typescript/tsconfig.json +4 -0
  31. data/lib/install/examples/vue/hello_vue.js +1 -1
  32. data/lib/install/loaders/elm.js +3 -4
  33. data/lib/install/loaders/vue.js +0 -5
  34. data/lib/install/react.rb +5 -4
  35. data/lib/install/template.rb +16 -19
  36. data/lib/install/typescript.rb +2 -2
  37. data/lib/install/vue.rb +3 -3
  38. data/lib/tasks/installers.rake +4 -2
  39. data/lib/tasks/webpacker.rake +1 -0
  40. data/lib/tasks/webpacker/binstubs.rake +3 -2
  41. data/lib/tasks/webpacker/info.rake +19 -0
  42. data/lib/tasks/webpacker/install.rake +3 -2
  43. data/lib/tasks/webpacker/verify_install.rake +1 -4
  44. data/lib/webpacker.rb +1 -0
  45. data/lib/webpacker/commands.rb +0 -1
  46. data/lib/webpacker/compiler.rb +10 -3
  47. data/lib/webpacker/configuration.rb +17 -7
  48. data/lib/webpacker/dev_server.rb +8 -4
  49. data/lib/webpacker/dev_server_proxy.rb +4 -0
  50. data/lib/webpacker/dev_server_runner.rb +17 -9
  51. data/lib/webpacker/env.rb +1 -1
  52. data/lib/webpacker/instance.rb +6 -2
  53. data/lib/webpacker/railtie.rb +15 -6
  54. data/lib/webpacker/runner.rb +3 -3
  55. data/lib/webpacker/version.rb +1 -1
  56. data/lib/webpacker/webpack_runner.rb +2 -2
  57. data/package.json +40 -33
  58. data/package/__tests__/config.js +17 -1
  59. data/package/__tests__/production.js +3 -1
  60. data/package/__tests__/staging.js +4 -2
  61. data/package/__tests__/test.js +4 -1
  62. data/package/config.js +9 -1
  63. data/package/config_types/config_list.js +5 -6
  64. data/package/dev_server.js +1 -1
  65. data/package/env.js +2 -2
  66. data/package/environments/base.js +26 -27
  67. data/package/environments/production.js +10 -1
  68. data/package/utils/__tests__/deep_assign.js +27 -6
  69. data/package/utils/deep_assign.js +1 -1
  70. data/package/utils/deep_merge.js +5 -6
  71. data/package/utils/get_style_rule.js +2 -5
  72. data/package/utils/helpers.js +3 -4
  73. data/package/utils/objectify.js +1 -2
  74. data/test/compiler_test.rb +2 -2
  75. data/test/configuration_test.rb +46 -22
  76. data/test/test_app/config.ru +5 -0
  77. data/test/test_helper.rb +3 -3
  78. data/test/webpacker_test.rb +13 -0
  79. data/webpacker.gemspec +5 -0
  80. data/yarn.lock +2758 -3258
  81. metadata +14 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9ff740a84754003342f8f34b560dca75fd9ee004d61f7b0b52d1c8f087d9f03
4
- data.tar.gz: 6faf6c891f003ef0cabefbc370a8937a24464cf92ac4379188ed7fe565048fed
3
+ metadata.gz: f8e384470d6faa4e062e9fdb92fb40b7c72b59cab7c35e7b3850f59da66fbdc6
4
+ data.tar.gz: 1d27eaeb75a2b05f359decd2b37c7d7624e55d3ccb5224969d58c0633f295fc1
5
5
  SHA512:
6
- metadata.gz: ef5e0178b7fd4a788a7c98990277fab1f643ccafa4758dd80ceb448d915ca7df03960beebf6cce82ddcd3bdb0e5e89637100c9bb4043fd8d0a7df65b54c9762a
7
- data.tar.gz: b79761d39e022de3374ffd21d5b6a990944713a448e27c14a614e261e259d0321de0e03bfab8135274bb538a4db1a2841f8ec9e3bd2ede002d45a6a925b3d33a
6
+ metadata.gz: 2fb2a78d8fbfdc1280d13288903a5572c1e09140e9b47f6f6acd092e9dfd004d1e2a6c5c36ad27c67925ac7b1994ac5bcc5fe8586c334b358467605f5a67615a
7
+ data.tar.gz: 30bf2a91f82b6e069545a891faaccbe419c1359cc547fe713bd5cfb6933cea393c8159eb37820178c7d41213d14a49cb31c9022eed713ca29664904ca7c41615
@@ -0,0 +1 @@
1
+ 6.14.0
@@ -11,6 +11,7 @@ gemfile:
11
11
  - gemfiles/Gemfile-rails.4.2.x
12
12
  - gemfiles/Gemfile-rails.5.0.x
13
13
  - gemfiles/Gemfile-rails.5.1.x
14
+ - gemfiles/Gemfile-rails.5.2.x
14
15
  - gemfiles/Gemfile-rails-edge
15
16
  cache:
16
17
  bundler: true
@@ -32,3 +33,6 @@ script:
32
33
  matrix:
33
34
  allow_failures:
34
35
  - gemfile: gemfiles/Gemfile-rails-edge
36
+ exclude:
37
+ - rvm: 2.3.7
38
+ gemfile: gemfiles/Gemfile-rails-edge
@@ -1,5 +1,22 @@
1
1
  **Please note that Webpacker 3.1.0 and 3.1.1 have some serious bugs so please consider using either 3.0.2 or 3.2.0**
2
2
 
3
+ ## [4.0.0-pre.3] - 2018-10-01
4
+
5
+ ### Added
6
+
7
+ - Move supported browsers configuration to [.browserslistrc](https://github.com/browserslist/browserslist#queries)
8
+
9
+ ## Breaking changes
10
+
11
+ - postcss-next is replaced with postcss-preset-env
12
+ - babel@7
13
+
14
+ ## Fixed
15
+
16
+ - Bring back test env [#1563](https://github.com/rails/webpacker/pull/1563)
17
+
18
+ Please see a list of [commits](https://github.com/rails/webpacker/compare/2dd68f0273074aadb3f869c4c30369d5e4e3fea7...master)
19
+
3
20
  ## [4.0.0-pre.2] - 2018-04-2
4
21
 
5
22
  ## Fixed
@@ -18,6 +35,9 @@ Pre-release to try out webpack 4.0 support
18
35
  - Remove compilation digest file if webpack command fails[#1398](https://github.com/rails/webpacker/issues/1398)
19
36
 
20
37
 
38
+ Please refer to [3-x-stable](https://github.com/rails/webpacker/tree/3-x-stable) branch
39
+ for further releases and changelogs:
40
+
21
41
  ## [3.4.1] - 2018-03-24
22
42
 
23
43
  ### Fixed
@@ -91,7 +111,7 @@ And, bunch of bug fixes [See changes](https://github.com/rails/webpacker/compare
91
111
 
92
112
  - Fix checking 'webpack' binstub on Windows [#1123](https://github.com/rails/webpacker/pull/1123)
93
113
 
94
- - silence yarn output if checking is successfull [#1131](https://github.com/rails/webpacker/pull/1131)
114
+ - silence yarn output if checking is successful [#1131](https://github.com/rails/webpacker/pull/1131)
95
115
 
96
116
  - Update uglifyJs plugin to support ES6 [#1194](https://github.com/rails/webpacker/pull/1194)
97
117
 
@@ -317,7 +337,7 @@ Webpacker.dev_server.connect_timeout = 1
317
337
 
318
338
  - Binstubs [#833](https://github.com/rails/webpacker/pull/833)
319
339
 
320
- - Allow dev server settings to be overriden by env variables [#843](https://github.com/rails/webpacker/pull/843)
340
+ - Allow dev server settings to be overridden by env variables [#843](https://github.com/rails/webpacker/pull/843)
321
341
 
322
342
  - A new `lookup` method to manifest to perform lookup without raise and return `nil`
323
343
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- webpacker (4.0.0.pre.pre.2)
4
+ webpacker (4.0.0.pre.3)
5
5
  activesupport (>= 4.2)
6
6
  rack-proxy (>= 0.6.1)
7
7
  railties (>= 4.2)
@@ -9,109 +9,119 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (5.1.6)
13
- actionpack (= 5.1.6)
12
+ actioncable (5.2.1)
13
+ actionpack (= 5.2.1)
14
14
  nio4r (~> 2.0)
15
- websocket-driver (~> 0.6.1)
16
- actionmailer (5.1.6)
17
- actionpack (= 5.1.6)
18
- actionview (= 5.1.6)
19
- activejob (= 5.1.6)
15
+ websocket-driver (>= 0.6.1)
16
+ actionmailer (5.2.1)
17
+ actionpack (= 5.2.1)
18
+ actionview (= 5.2.1)
19
+ activejob (= 5.2.1)
20
20
  mail (~> 2.5, >= 2.5.4)
21
21
  rails-dom-testing (~> 2.0)
22
- actionpack (5.1.6)
23
- actionview (= 5.1.6)
24
- activesupport (= 5.1.6)
22
+ actionpack (5.2.1)
23
+ actionview (= 5.2.1)
24
+ activesupport (= 5.2.1)
25
25
  rack (~> 2.0)
26
26
  rack-test (>= 0.6.3)
27
27
  rails-dom-testing (~> 2.0)
28
28
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- actionview (5.1.6)
30
- activesupport (= 5.1.6)
29
+ actionview (5.2.1)
30
+ activesupport (= 5.2.1)
31
31
  builder (~> 3.1)
32
32
  erubi (~> 1.4)
33
33
  rails-dom-testing (~> 2.0)
34
34
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
- activejob (5.1.6)
36
- activesupport (= 5.1.6)
35
+ activejob (5.2.1)
36
+ activesupport (= 5.2.1)
37
37
  globalid (>= 0.3.6)
38
- activemodel (5.1.6)
39
- activesupport (= 5.1.6)
40
- activerecord (5.1.6)
41
- activemodel (= 5.1.6)
42
- activesupport (= 5.1.6)
43
- arel (~> 8.0)
44
- activesupport (5.1.6)
38
+ activemodel (5.2.1)
39
+ activesupport (= 5.2.1)
40
+ activerecord (5.2.1)
41
+ activemodel (= 5.2.1)
42
+ activesupport (= 5.2.1)
43
+ arel (>= 9.0)
44
+ activestorage (5.2.1)
45
+ actionpack (= 5.2.1)
46
+ activerecord (= 5.2.1)
47
+ marcel (~> 0.3.1)
48
+ activesupport (5.2.1)
45
49
  concurrent-ruby (~> 1.0, >= 1.0.2)
46
50
  i18n (>= 0.7, < 2)
47
51
  minitest (~> 5.1)
48
52
  tzinfo (~> 1.1)
49
- arel (8.0.0)
53
+ arel (9.0.0)
50
54
  ast (2.4.0)
51
55
  builder (3.2.3)
52
56
  byebug (10.0.2)
53
57
  concurrent-ruby (1.0.5)
54
- crass (1.0.3)
58
+ crass (1.0.4)
55
59
  erubi (1.7.1)
56
60
  globalid (0.4.1)
57
61
  activesupport (>= 4.2.0)
58
- i18n (1.0.0)
62
+ i18n (1.1.0)
59
63
  concurrent-ruby (~> 1.0)
64
+ jaro_winkler (1.5.1)
60
65
  loofah (2.2.2)
61
66
  crass (~> 1.0.2)
62
67
  nokogiri (>= 1.5.9)
63
68
  mail (2.7.0)
64
69
  mini_mime (>= 0.1.1)
70
+ marcel (0.3.2)
71
+ mimemagic (~> 0.3.2)
65
72
  method_source (0.9.0)
66
- mini_mime (1.0.0)
73
+ mimemagic (0.3.2)
74
+ mini_mime (1.0.1)
67
75
  mini_portile2 (2.3.0)
68
76
  minitest (5.11.3)
69
- nio4r (2.3.0)
70
- nokogiri (1.8.2)
77
+ nio4r (2.3.1)
78
+ nokogiri (1.8.4)
71
79
  mini_portile2 (~> 2.3.0)
72
80
  parallel (1.12.1)
73
- parser (2.5.0.5)
81
+ parser (2.5.1.2)
74
82
  ast (~> 2.4.0)
75
- powerpack (0.1.1)
76
- rack (2.0.4)
83
+ powerpack (0.1.2)
84
+ rack (2.0.5)
77
85
  rack-proxy (0.6.4)
78
86
  rack
79
- rack-test (1.0.0)
87
+ rack-test (1.1.0)
80
88
  rack (>= 1.0, < 3)
81
- rails (5.1.6)
82
- actioncable (= 5.1.6)
83
- actionmailer (= 5.1.6)
84
- actionpack (= 5.1.6)
85
- actionview (= 5.1.6)
86
- activejob (= 5.1.6)
87
- activemodel (= 5.1.6)
88
- activerecord (= 5.1.6)
89
- activesupport (= 5.1.6)
89
+ rails (5.2.1)
90
+ actioncable (= 5.2.1)
91
+ actionmailer (= 5.2.1)
92
+ actionpack (= 5.2.1)
93
+ actionview (= 5.2.1)
94
+ activejob (= 5.2.1)
95
+ activemodel (= 5.2.1)
96
+ activerecord (= 5.2.1)
97
+ activestorage (= 5.2.1)
98
+ activesupport (= 5.2.1)
90
99
  bundler (>= 1.3.0)
91
- railties (= 5.1.6)
100
+ railties (= 5.2.1)
92
101
  sprockets-rails (>= 2.0.0)
93
102
  rails-dom-testing (2.0.3)
94
103
  activesupport (>= 4.2.0)
95
104
  nokogiri (>= 1.6)
96
105
  rails-html-sanitizer (1.0.4)
97
106
  loofah (~> 2.2, >= 2.2.2)
98
- railties (5.1.6)
99
- actionpack (= 5.1.6)
100
- activesupport (= 5.1.6)
107
+ railties (5.2.1)
108
+ actionpack (= 5.2.1)
109
+ activesupport (= 5.2.1)
101
110
  method_source
102
111
  rake (>= 0.8.7)
103
- thor (>= 0.18.1, < 2.0)
112
+ thor (>= 0.19.0, < 2.0)
104
113
  rainbow (3.0.0)
105
114
  rake (12.3.1)
106
- rubocop (0.54.0)
115
+ rubocop (0.58.2)
116
+ jaro_winkler (~> 1.5.1)
107
117
  parallel (~> 1.10)
108
- parser (>= 2.5)
118
+ parser (>= 2.5, != 2.5.1.1)
109
119
  powerpack (~> 0.1)
110
120
  rainbow (>= 2.2.2, < 4.0)
111
121
  ruby-progressbar (~> 1.7)
112
122
  unicode-display_width (~> 1.0, >= 1.0.1)
113
- ruby-progressbar (1.9.0)
114
- sprockets (3.7.1)
123
+ ruby-progressbar (1.10.0)
124
+ sprockets (3.7.2)
115
125
  concurrent-ruby (~> 1.0)
116
126
  rack (> 1, < 3)
117
127
  sprockets-rails (3.2.1)
@@ -122,8 +132,8 @@ GEM
122
132
  thread_safe (0.3.6)
123
133
  tzinfo (1.2.5)
124
134
  thread_safe (~> 0.1)
125
- unicode-display_width (1.3.0)
126
- websocket-driver (0.6.5)
135
+ unicode-display_width (1.4.0)
136
+ websocket-driver (0.7.0)
127
137
  websocket-extensions (>= 0.1.0)
128
138
  websocket-extensions (0.1.3)
129
139
 
@@ -141,4 +151,4 @@ DEPENDENCIES
141
151
  webpacker!
142
152
 
143
153
  BUNDLED WITH
144
- 1.16.1
154
+ 1.16.4
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # Webpacker
2
2
 
3
3
  ![travis-ci status](https://api.travis-ci.org/rails/webpacker.svg?branch=master)
4
- [![node.js](https://img.shields.io/badge/node-%3E%3D%206.0.0-brightgreen.svg)](https://nodejs.org/en/)
4
+ [![node.js](https://img.shields.io/badge/node-%3E%3D%206.14.0-brightgreen.svg)](https://nodejs.org/en/)
5
5
  [![Gem](https://img.shields.io/gem/v/webpacker.svg)](https://github.com/rails/webpacker)
6
6
 
7
7
  Webpacker makes it easy to use the JavaScript pre-processor and bundler
8
- [webpack 3.x.x+](https://webpack.js.org/)
8
+ [webpack 4.x.x+](https://webpack.js.org/)
9
9
  to manage application-like JavaScript in Rails. It coexists with the asset pipeline,
10
10
  as the primary purpose for webpack is app-like JavaScript, not images, CSS, or
11
11
  even JavaScript Sprinkles (that all continues to live in app/assets).
@@ -13,6 +13,8 @@ even JavaScript Sprinkles (that all continues to live in app/assets).
13
13
  However, it is possible to use Webpacker for CSS, images and fonts assets as well,
14
14
  in which case you may not even need the asset pipeline. This is mostly relevant when exclusively using component-based JavaScript frameworks.
15
15
 
16
+ **NOTE:** The master branch now hosts the code for v4.x.x. Please refer to [3-x-stable](https://github.com/rails/webpacker/tree/3-x-stable) branch for 3.x documentation.
17
+
16
18
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
17
19
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
18
20
  ## Table of Contents
@@ -48,13 +50,13 @@ in which case you may not even need the asset pipeline. This is mostly relevant
48
50
 
49
51
  * Ruby 2.2+
50
52
  * Rails 4.2+
51
- * Node.js 6.0.0+
52
- * Yarn 0.25.2+
53
+ * Node.js 6.14.0+
54
+ * Yarn 1.x+
53
55
 
54
56
 
55
57
  ## Features
56
58
 
57
- * [webpack 3.x.x](https://webpack.js.org/)
59
+ * [webpack 4.x.x](https://webpack.js.org/)
58
60
  * ES6 with [babel](https://babeljs.io/)
59
61
  * Automatic code splitting using multiple entry points
60
62
  * Stylesheets - Sass and CSS
@@ -81,16 +83,18 @@ Or add it to your `Gemfile`:
81
83
 
82
84
  ```ruby
83
85
  # Gemfile
84
- gem 'webpacker', '~> 3.4'
86
+ gem 'webpacker', '~> 3.5'
85
87
 
86
88
  # OR if you prefer to use master
87
89
  gem 'webpacker', git: 'https://github.com/rails/webpacker.git'
90
+ yarn add https://github.com/rails/webpacker.git
88
91
 
89
92
  # OR to try out 4.x pre-release
90
93
  gem 'webpacker', '>= 4.0.x'
94
+ yarn add @rails/webpacker@4.0.0-pre.2
91
95
  ```
92
96
 
93
- Finally, run following to install Webpacker:
97
+ Finally, run the following to install Webpacker:
94
98
 
95
99
  ```bash
96
100
  bundle
@@ -100,6 +104,11 @@ bundle exec rails webpacker:install
100
104
  bundle exec rake webpacker:install
101
105
  ```
102
106
 
107
+ Optional: To fix ["unmet peer dependency" warnings](https://github.com/rails/webpacker/issues/1078),
108
+
109
+ ```bash
110
+ yarn upgrade
111
+ ```
103
112
 
104
113
  ### Usage
105
114
 
@@ -157,7 +166,7 @@ in the `app/javascript/packs/*.js` files and automatically reload the browser to
157
166
  ./bin/webpack-dev-server
158
167
 
159
168
  # watcher
160
- ./bin/webpack --colors --progress
169
+ ./bin/webpack --watch --colors --progress
161
170
 
162
171
  # standalone build
163
172
  ./bin/webpack
@@ -189,7 +198,9 @@ WEBPACKER_DEV_SERVER_HOST=0.0.0.0 ./bin/webpack-dev-server
189
198
  **Note:** You need to allow webpack-dev-server host as an allowed origin for `connect-src` if you are running your application in a restrict CSP environment (like Rails 5.2+). This can be done in Rails 5.2+ in the CSP initializer `config/initializers/content_security_policy.rb` with a snippet like this:
190
199
 
191
200
  ```ruby
192
- p.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' if Rails.env.development?
201
+ Rails.application.config.content_security_policy do |policy|
202
+ policy.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' if Rails.env.development?
203
+ end
193
204
  ```
194
205
 
195
206
  **Note:** Don't forget to prefix `ruby` when running these binstubs on Windows
@@ -251,31 +262,36 @@ bundle exec rails webpacker:compile
251
262
 
252
263
  ### Upgrading
253
264
 
254
- You can run following commands to upgrade Webpacker to the latest stable version. This process involves upgrading the gem and related npm modules:
265
+ You can run following commands to upgrade Webpacker to the latest stable version. This process involves upgrading the gem and related JavaScript packages:
255
266
 
256
267
  ```bash
257
268
  bundle update webpacker
269
+ rails webpacker:binstubs
258
270
  yarn upgrade @rails/webpacker --latest
259
271
  yarn add webpack-dev-server@^2.11.1
260
272
 
261
273
  # Or to install a latest release (including pre-releases)
262
- yarn add @rails/webpacker
274
+ yarn add @rails/webpacker@4.0.0-pre.2
263
275
  ```
264
276
 
265
277
  ### Yarn Integrity
266
278
 
267
- By default, in development, webpacker runs a yarn integrity check to ensure that all local npm packages are up-to-date. This is similar to what bundler does currently in Rails, but for JavaScript packages. If your system is out of date, then Rails will not initialize. You will be asked to upgrade your local npm packages by running `yarn install`.
279
+ By default, in development, webpacker runs a yarn integrity check to ensure that all local JavaScript packages are up-to-date. This is similar to what bundler does currently in Rails, but for JavaScript packages. If your system is out of date, then Rails will not initialize. You will be asked to upgrade your local JavaScript packages by running `yarn install`.
268
280
 
269
- To turn off this option, you will need to override the default by adding a new config option to your Rails development environment configuration file (`config/environment/development.rb`):
281
+ To turn off this option, you will need to change the default setting in `config/webpacker.yml`:
270
282
 
271
- ```
272
- config.webpacker.check_yarn_integrity = false
283
+ ```yaml
284
+ # config/webpacker.yml
285
+ development:
286
+ ...
287
+ # Verifies that versions and hashed value of the package contents in the project's package.json
288
+ check_yarn_integrity: false
273
289
  ```
274
290
 
275
- You may also turn on this feature by adding the config option to any Rails environment configuration file:
291
+ You may also turn on this feature by adding the config option for any Rails environment in `config/webpacker.yml`:
276
292
 
277
- ```
278
- config.webpacker.check_yarn_integrity = true
293
+ ```yaml
294
+ check_yarn_integrity: true
279
295
  ```
280
296
 
281
297
  ## Integrations
@@ -330,9 +346,9 @@ with the following code:
330
346
 
331
347
  ```ruby
332
348
  if Rails.env.development?
333
- p.script_src :self, :https, :unsafe_eval
349
+ policy.script_src :self, :https, :unsafe_eval
334
350
  else
335
- p.script_src :self, :https
351
+ policy.script_src :self, :https
336
352
  end
337
353
  ```
338
354
 
@@ -358,9 +374,9 @@ configuration:
358
374
 
359
375
  ```ruby
360
376
  if Rails.env.development?
361
- p.script_src :self, :https, :unsafe_eval
377
+ policy.script_src :self, :https, :unsafe_eval
362
378
  else
363
- p.script_src :self, :https
379
+ policy.script_src :self, :https
364
380
  end
365
381
  ```
366
382
  You can read more about this in the [Vue docs](https://vuejs.org/v2/guide/installation.html#CSP-environments).
@@ -492,7 +508,7 @@ Webpacker::Compiler.watched_paths << 'bower_components'
492
508
 
493
509
  ## Deployment
494
510
 
495
- Webpacker hooks up a new `webpacker:compile` task to `assets:precompile`, which gets run whenever you run `assets:precompile`. If you are not using Sprockets, `webpacker:compile` is automatically aliased to `assets:precompile`. Remember to set NODE_ENV environment variable to production during deployment or when running this rake task.
511
+ Webpacker hooks up a new `webpacker:compile` task to `assets:precompile`, which gets run whenever you run `assets:precompile`. If you are not using Sprockets, `webpacker:compile` is automatically aliased to `assets:precompile`. Similar to sprockets both rake tasks will compile packs in production mode but will use `RAILS_ENV` to load configuration from `config/webpacker.yml` (if available).
496
512
 
497
513
  ## Docs
498
514
 
data/Rakefile CHANGED
@@ -2,9 +2,8 @@
2
2
  require "bundler/gem_tasks"
3
3
  require "rake/testtask"
4
4
 
5
- Rake::TestTask.new(:test) do |t|
5
+ Rake::TestTask.new do |t|
6
6
  t.libs << "test"
7
- t.libs << "lib"
8
7
  t.test_files = FileList["test/**/*_test.rb"]
9
8
  t.verbose = true
10
9
  end