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.
- checksums.yaml +4 -4
- data/.node-version +1 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +22 -2
- data/Gemfile.lock +63 -53
- data/README.md +39 -23
- data/Rakefile +1 -2
- data/docs/cloud9.md +1 -1
- data/docs/css.md +1 -1
- data/docs/es6.md +4 -4
- data/docs/testing.md +1 -1
- data/docs/webpack.md +4 -0
- data/gemfiles/Gemfile-rails.4.2.x +1 -1
- data/gemfiles/Gemfile-rails.5.0.x +1 -1
- data/gemfiles/Gemfile-rails.5.1.x +1 -1
- data/gemfiles/Gemfile-rails.5.2.x +10 -0
- data/lib/install/angular.rb +2 -2
- data/lib/install/bin/webpack +6 -2
- data/lib/install/bin/webpack-dev-server +6 -2
- data/lib/install/coffee.rb +1 -1
- data/lib/install/config/.babelrc +35 -12
- data/lib/install/config/.browserslistrc +1 -0
- data/lib/install/config/.postcssrc.yml +1 -1
- data/lib/install/config/webpacker.yml +4 -0
- data/lib/install/elm.rb +5 -4
- data/lib/install/erb.rb +1 -1
- data/lib/install/examples/react/.babelrc +43 -2
- data/lib/install/examples/stimulus/application.js +1 -6
- data/lib/install/examples/stimulus/controllers/index.js +9 -0
- data/lib/install/examples/typescript/tsconfig.json +4 -0
- data/lib/install/examples/vue/hello_vue.js +1 -1
- data/lib/install/loaders/elm.js +3 -4
- data/lib/install/loaders/vue.js +0 -5
- data/lib/install/react.rb +5 -4
- data/lib/install/template.rb +16 -19
- data/lib/install/typescript.rb +2 -2
- data/lib/install/vue.rb +3 -3
- data/lib/tasks/installers.rake +4 -2
- data/lib/tasks/webpacker.rake +1 -0
- data/lib/tasks/webpacker/binstubs.rake +3 -2
- data/lib/tasks/webpacker/info.rake +19 -0
- data/lib/tasks/webpacker/install.rake +3 -2
- data/lib/tasks/webpacker/verify_install.rake +1 -4
- data/lib/webpacker.rb +1 -0
- data/lib/webpacker/commands.rb +0 -1
- data/lib/webpacker/compiler.rb +10 -3
- data/lib/webpacker/configuration.rb +17 -7
- data/lib/webpacker/dev_server.rb +8 -4
- data/lib/webpacker/dev_server_proxy.rb +4 -0
- data/lib/webpacker/dev_server_runner.rb +17 -9
- data/lib/webpacker/env.rb +1 -1
- data/lib/webpacker/instance.rb +6 -2
- data/lib/webpacker/railtie.rb +15 -6
- data/lib/webpacker/runner.rb +3 -3
- data/lib/webpacker/version.rb +1 -1
- data/lib/webpacker/webpack_runner.rb +2 -2
- data/package.json +40 -33
- data/package/__tests__/config.js +17 -1
- data/package/__tests__/production.js +3 -1
- data/package/__tests__/staging.js +4 -2
- data/package/__tests__/test.js +4 -1
- data/package/config.js +9 -1
- data/package/config_types/config_list.js +5 -6
- data/package/dev_server.js +1 -1
- data/package/env.js +2 -2
- data/package/environments/base.js +26 -27
- data/package/environments/production.js +10 -1
- data/package/utils/__tests__/deep_assign.js +27 -6
- data/package/utils/deep_assign.js +1 -1
- data/package/utils/deep_merge.js +5 -6
- data/package/utils/get_style_rule.js +2 -5
- data/package/utils/helpers.js +3 -4
- data/package/utils/objectify.js +1 -2
- data/test/compiler_test.rb +2 -2
- data/test/configuration_test.rb +46 -22
- data/test/test_app/config.ru +5 -0
- data/test/test_helper.rb +3 -3
- data/test/webpacker_test.rb +13 -0
- data/webpacker.gemspec +5 -0
- data/yarn.lock +2758 -3258
- metadata +14 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8e384470d6faa4e062e9fdb92fb40b7c72b59cab7c35e7b3850f59da66fbdc6
|
4
|
+
data.tar.gz: 1d27eaeb75a2b05f359decd2b37c7d7624e55d3ccb5224969d58c0633f295fc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fb2a78d8fbfdc1280d13288903a5572c1e09140e9b47f6f6acd092e9dfd004d1e2a6c5c36ad27c67925ac7b1994ac5bcc5fe8586c334b358467605f5a67615a
|
7
|
+
data.tar.gz: 30bf2a91f82b6e069545a891faaccbe419c1359cc547fe713bd5cfb6933cea393c8159eb37820178c7d41213d14a49cb31c9022eed713ca29664904ca7c41615
|
data/.node-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
6.14.0
|
data/.travis.yml
CHANGED
@@ -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
|
data/CHANGELOG.md
CHANGED
@@ -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
|
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
|
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
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
webpacker (4.0.0.pre.
|
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
|
13
|
-
actionpack (= 5.1
|
12
|
+
actioncable (5.2.1)
|
13
|
+
actionpack (= 5.2.1)
|
14
14
|
nio4r (~> 2.0)
|
15
|
-
websocket-driver (
|
16
|
-
actionmailer (5.1
|
17
|
-
actionpack (= 5.1
|
18
|
-
actionview (= 5.1
|
19
|
-
activejob (= 5.1
|
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
|
23
|
-
actionview (= 5.1
|
24
|
-
activesupport (= 5.1
|
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
|
30
|
-
activesupport (= 5.1
|
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
|
36
|
-
activesupport (= 5.1
|
35
|
+
activejob (5.2.1)
|
36
|
+
activesupport (= 5.2.1)
|
37
37
|
globalid (>= 0.3.6)
|
38
|
-
activemodel (5.1
|
39
|
-
activesupport (= 5.1
|
40
|
-
activerecord (5.1
|
41
|
-
activemodel (= 5.1
|
42
|
-
activesupport (= 5.1
|
43
|
-
arel (
|
44
|
-
|
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 (
|
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.
|
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.
|
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
|
-
|
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.
|
70
|
-
nokogiri (1.8.
|
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.
|
81
|
+
parser (2.5.1.2)
|
74
82
|
ast (~> 2.4.0)
|
75
|
-
powerpack (0.1.
|
76
|
-
rack (2.0.
|
83
|
+
powerpack (0.1.2)
|
84
|
+
rack (2.0.5)
|
77
85
|
rack-proxy (0.6.4)
|
78
86
|
rack
|
79
|
-
rack-test (1.
|
87
|
+
rack-test (1.1.0)
|
80
88
|
rack (>= 1.0, < 3)
|
81
|
-
rails (5.1
|
82
|
-
actioncable (= 5.1
|
83
|
-
actionmailer (= 5.1
|
84
|
-
actionpack (= 5.1
|
85
|
-
actionview (= 5.1
|
86
|
-
activejob (= 5.1
|
87
|
-
activemodel (= 5.1
|
88
|
-
activerecord (= 5.1
|
89
|
-
|
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
|
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
|
99
|
-
actionpack (= 5.1
|
100
|
-
activesupport (= 5.1
|
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.
|
112
|
+
thor (>= 0.19.0, < 2.0)
|
104
113
|
rainbow (3.0.0)
|
105
114
|
rake (12.3.1)
|
106
|
-
rubocop (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.
|
114
|
-
sprockets (3.7.
|
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.
|
126
|
-
websocket-driver (0.
|
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.
|
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.
|
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
|
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.
|
52
|
-
* Yarn
|
53
|
+
* Node.js 6.14.0+
|
54
|
+
* Yarn 1.x+
|
53
55
|
|
54
56
|
|
55
57
|
## Features
|
56
58
|
|
57
|
-
* [webpack
|
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.
|
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
|
-
|
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
|
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
|
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
|
281
|
+
To turn off this option, you will need to change the default setting in `config/webpacker.yml`:
|
270
282
|
|
271
|
-
```
|
272
|
-
config
|
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
|
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
|
-
|
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
|
-
|
349
|
+
policy.script_src :self, :https, :unsafe_eval
|
334
350
|
else
|
335
|
-
|
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
|
-
|
377
|
+
policy.script_src :self, :https, :unsafe_eval
|
362
378
|
else
|
363
|
-
|
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`.
|
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
|
|