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
data/docs/cloud9.md
CHANGED
data/docs/css.md
CHANGED
data/docs/es6.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
Webpacker ships with [babel](https://babeljs.io/) - a JavaScript compiler so
|
7
7
|
you can use next generation JavaScript, today. The Webpacker installer sets up a
|
8
8
|
standard `.babelrc` file in your app root, which will work great in most cases
|
9
|
-
because of [babel-env
|
9
|
+
because of [@babel/preset-env](https://github.com/babel/babel/tree/master/packages/babel-preset-env).
|
10
10
|
|
11
11
|
Following ES6/7 features are supported out of the box:
|
12
12
|
|
@@ -19,14 +19,14 @@ Following ES6/7 features are supported out of the box:
|
|
19
19
|
We have also included [babel polyfill](https://babeljs.io/docs/usage/polyfill/)
|
20
20
|
that includes a custom regenerator runtime and core-js.
|
21
21
|
|
22
|
-
Don't forget to import
|
22
|
+
Don't forget to import `@babel/polyfill` in your main entry point like so:
|
23
23
|
|
24
24
|
```js
|
25
|
-
import "babel
|
25
|
+
import "@babel/polyfill"
|
26
26
|
```
|
27
27
|
|
28
28
|
|
29
|
-
## Module import
|
29
|
+
## Module import vs require()
|
30
30
|
|
31
31
|
While you are free to use `require()` and `module.exports`, we encourage you
|
32
32
|
to use `import` and `export` instead since it reads and looks much better.
|
data/docs/testing.md
CHANGED
@@ -34,7 +34,7 @@ It is beneficial to use the same webpack configuration file (generated by webpac
|
|
34
34
|
// config/webpack/test.js
|
35
35
|
const environment = require('./environment')
|
36
36
|
environment.plugins.get('Manifest').opts.writeToFileEmit = process.env.NODE_ENV !== 'test'
|
37
|
-
environment.loaders.
|
37
|
+
environment.loaders.append('istanbul-instrumenter', {
|
38
38
|
test: /\.ts$/,
|
39
39
|
enforce: "post",
|
40
40
|
loader: "istanbul-instrumenter-loader",
|
data/docs/webpack.md
CHANGED
@@ -168,8 +168,12 @@ module.exports = {
|
|
168
168
|
// config/webpack/environment.js
|
169
169
|
|
170
170
|
const { environment } = require('@rails/webpacker')
|
171
|
+
const url = require('./loaders/url')
|
171
172
|
|
172
173
|
environment.loaders.prepend('url', url)
|
174
|
+
|
175
|
+
// avoid using both file and url loaders
|
176
|
+
environment.loaders.get('file').test = /\.(tiff|ico|svg|eot|otf|ttf|woff|woff2)$/i
|
173
177
|
```
|
174
178
|
|
175
179
|
### Overriding Loader Options in webpack 3+ (for CSS Modules etc.)
|
data/lib/install/angular.rb
CHANGED
@@ -14,9 +14,9 @@ if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR > 1
|
|
14
14
|
say "This can be done in Rails 5.2+ for development environment in the CSP initializer", :yellow
|
15
15
|
say "config/initializers/content_security_policy.rb with a snippet like this:", :yellow
|
16
16
|
say "if Rails.env.development?", :yellow
|
17
|
-
say "
|
17
|
+
say " policy.script_src :self, :https, :unsafe_eval", :yellow
|
18
18
|
say "else", :yellow
|
19
|
-
say "
|
19
|
+
say " policy.script_src :self, :https", :yellow
|
20
20
|
say "end", :yellow
|
21
21
|
end
|
22
22
|
|
data/lib/install/bin/webpack
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
4
|
-
ENV["NODE_ENV"] ||=
|
4
|
+
ENV["NODE_ENV"] ||= "development"
|
5
5
|
|
6
6
|
require "pathname"
|
7
7
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
@@ -12,4 +12,8 @@ require "bundler/setup"
|
|
12
12
|
|
13
13
|
require "webpacker"
|
14
14
|
require "webpacker/webpack_runner"
|
15
|
-
|
15
|
+
|
16
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
17
|
+
Dir.chdir(APP_ROOT) do
|
18
|
+
Webpacker::WebpackRunner.run(ARGV)
|
19
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
|
4
|
-
ENV["NODE_ENV"] ||=
|
4
|
+
ENV["NODE_ENV"] ||= "development"
|
5
5
|
|
6
6
|
require "pathname"
|
7
7
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
@@ -12,4 +12,8 @@ require "bundler/setup"
|
|
12
12
|
|
13
13
|
require "webpacker"
|
14
14
|
require "webpacker/dev_server_runner"
|
15
|
-
|
15
|
+
|
16
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
17
|
+
Dir.chdir(APP_ROOT) do
|
18
|
+
Webpacker::DevServerRunner.run(ARGV)
|
19
|
+
end
|
data/lib/install/coffee.rb
CHANGED
@@ -13,7 +13,7 @@ insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
|
|
13
13
|
before: "module.exports"
|
14
14
|
|
15
15
|
say "Updating webpack paths to include .coffee file extension"
|
16
|
-
insert_into_file Webpacker.config.config_path, "
|
16
|
+
insert_into_file Webpacker.config.config_path, "- .coffee\n".indent(4), after: /extensions:\n/
|
17
17
|
|
18
18
|
say "Copying the example entry file to #{Webpacker.config.source_entry_path}"
|
19
19
|
copy_file "#{__dir__}/examples/coffee/hello_coffee.coffee",
|
data/lib/install/config/.babelrc
CHANGED
@@ -1,18 +1,41 @@
|
|
1
1
|
{
|
2
2
|
"presets": [
|
3
|
-
[
|
4
|
-
"
|
5
|
-
|
6
|
-
"
|
7
|
-
"
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
[
|
4
|
+
"@babel/preset-env",
|
5
|
+
{
|
6
|
+
"modules": false,
|
7
|
+
"forceAllTransforms": true,
|
8
|
+
"useBuiltIns": "entry"
|
9
|
+
}
|
10
|
+
]
|
11
11
|
],
|
12
|
-
|
13
12
|
"plugins": [
|
14
|
-
"
|
15
|
-
"
|
16
|
-
[
|
13
|
+
"@babel/plugin-transform-destructuring",
|
14
|
+
"@babel/plugin-syntax-dynamic-import",
|
15
|
+
[
|
16
|
+
"@babel/plugin-proposal-object-rest-spread",
|
17
|
+
{
|
18
|
+
"useBuiltIns": true
|
19
|
+
}
|
20
|
+
],
|
21
|
+
[
|
22
|
+
"@babel/plugin-transform-runtime",
|
23
|
+
{
|
24
|
+
"helpers": false,
|
25
|
+
"regenerator": true
|
26
|
+
}
|
27
|
+
],
|
28
|
+
[
|
29
|
+
"@babel/plugin-transform-regenerator",
|
30
|
+
{
|
31
|
+
"async": false
|
32
|
+
}
|
33
|
+
],
|
34
|
+
[
|
35
|
+
"@babel/plugin-proposal-class-properties",
|
36
|
+
{
|
37
|
+
"loose": true
|
38
|
+
}
|
39
|
+
]
|
17
40
|
]
|
18
41
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
> 1%
|
@@ -5,6 +5,7 @@ default: &default
|
|
5
5
|
source_entry_path: packs
|
6
6
|
public_output_path: packs
|
7
7
|
cache_path: tmp/cache/webpacker
|
8
|
+
check_yarn_integrity: false
|
8
9
|
|
9
10
|
# Additional paths webpack should lookup modules
|
10
11
|
# ['app/assets', 'engine/foo/app/assets']
|
@@ -31,6 +32,9 @@ development:
|
|
31
32
|
<<: *default
|
32
33
|
compile: true
|
33
34
|
|
35
|
+
# Verifies that versions and hashed value of the package contents in the project's package.json
|
36
|
+
check_yarn_integrity: true
|
37
|
+
|
34
38
|
# Reference: https://webpack.js.org/configuration/dev-server/
|
35
39
|
dev_server:
|
36
40
|
https: false
|
data/lib/install/elm.rb
CHANGED
@@ -22,14 +22,15 @@ copy_file "#{__dir__}/examples/elm/Main.elm",
|
|
22
22
|
|
23
23
|
say "Installing all Elm dependencies"
|
24
24
|
run "yarn add elm elm-webpack-loader"
|
25
|
-
run "yarn add --dev elm-hot-loader"
|
26
|
-
run "yarn run elm
|
25
|
+
run "yarn add --dev elm-hot-webpack-loader"
|
26
|
+
run "yarn run elm init"
|
27
|
+
run "yarn run elm make"
|
27
28
|
|
28
29
|
say "Updating webpack paths to include .elm file extension"
|
29
|
-
insert_into_file Webpacker.config.config_path, "
|
30
|
+
insert_into_file Webpacker.config.config_path, "- .elm\n".indent(4), after: /extensions:\n/
|
30
31
|
|
31
32
|
say "Updating Elm source location"
|
32
|
-
gsub_file "elm
|
33
|
+
gsub_file "elm.json", /\"\src\"\n/,
|
33
34
|
%("#{Webpacker.config.source_path.relative_path_from(Rails.root)}"\n)
|
34
35
|
|
35
36
|
say "Updating .gitignore to include elm-stuff folder"
|
data/lib/install/erb.rb
CHANGED
@@ -13,7 +13,7 @@ insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
|
|
13
13
|
before: "module.exports"
|
14
14
|
|
15
15
|
say "Updating webpack paths to include .erb file extension"
|
16
|
-
insert_into_file Webpacker.config.config_path, "
|
16
|
+
insert_into_file Webpacker.config.config_path, "- .erb\n".indent(4), after: /extensions:\n/
|
17
17
|
|
18
18
|
say "Copying the example entry file to #{Webpacker.config.source_entry_path}"
|
19
19
|
copy_file "#{__dir__}/examples/erb/hello_erb.js.erb",
|
@@ -1,6 +1,47 @@
|
|
1
1
|
{
|
2
2
|
"presets": [
|
3
|
-
[
|
4
|
-
|
3
|
+
[
|
4
|
+
"@babel/preset-env",
|
5
|
+
{
|
6
|
+
"modules": false,
|
7
|
+
"forceAllTransforms": true,
|
8
|
+
"useBuiltIns": "entry"
|
9
|
+
}
|
10
|
+
],
|
11
|
+
[
|
12
|
+
"@babel/preset-react",
|
13
|
+
{
|
14
|
+
"useBuiltIns": true
|
15
|
+
}
|
16
|
+
]
|
17
|
+
],
|
18
|
+
"plugins": [
|
19
|
+
"@babel/plugin-transform-destructuring",
|
20
|
+
"@babel/plugin-syntax-dynamic-import",
|
21
|
+
[
|
22
|
+
"@babel/plugin-proposal-object-rest-spread",
|
23
|
+
{
|
24
|
+
"useBuiltIns": true
|
25
|
+
}
|
26
|
+
],
|
27
|
+
[
|
28
|
+
"@babel/plugin-transform-runtime",
|
29
|
+
{
|
30
|
+
"helpers": false,
|
31
|
+
"regenerator": true
|
32
|
+
}
|
33
|
+
],
|
34
|
+
[
|
35
|
+
"@babel/plugin-transform-regenerator",
|
36
|
+
{
|
37
|
+
"async": false
|
38
|
+
}
|
39
|
+
],
|
40
|
+
[
|
41
|
+
"@babel/plugin-proposal-class-properties",
|
42
|
+
{
|
43
|
+
"loose": true
|
44
|
+
}
|
45
|
+
]
|
5
46
|
]
|
6
47
|
}
|
@@ -1,6 +1 @@
|
|
1
|
-
import
|
2
|
-
import { definitionsFromContext } from "stimulus/webpack-helpers"
|
3
|
-
|
4
|
-
const application = Application.start()
|
5
|
-
const context = require.context("controllers", true, /.js$/)
|
6
|
-
application.load(definitionsFromContext(context))
|
1
|
+
import "controllers"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
// Load all the controllers within this directory and all subdirectories.
|
2
|
+
// Controller files must be named *_controller.js.
|
3
|
+
|
4
|
+
import { Application } from "stimulus"
|
5
|
+
import { definitionsFromContext } from "stimulus/webpack-helpers"
|
6
|
+
|
7
|
+
const application = Application.start()
|
8
|
+
const context = require.context("controllers", true, /_controller\.js$/)
|
9
|
+
application.load(definitionsFromContext(context))
|
@@ -54,7 +54,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
54
54
|
//
|
55
55
|
// Then uncomment the code block below:
|
56
56
|
//
|
57
|
-
// import TurbolinksAdapter from 'vue-turbolinks'
|
57
|
+
// import TurbolinksAdapter from 'vue-turbolinks'
|
58
58
|
// import Vue from 'vue/dist/vue.esm'
|
59
59
|
// import App from '../app.vue'
|
60
60
|
//
|
data/lib/install/loaders/elm.js
CHANGED
@@ -2,12 +2,11 @@ const { resolve } = require('path')
|
|
2
2
|
|
3
3
|
const isProduction = process.env.NODE_ENV === 'production'
|
4
4
|
const elmSource = resolve(process.cwd())
|
5
|
-
const
|
5
|
+
const elmBinary = `${elmSource}/node_modules/.bin/elm`
|
6
6
|
|
7
|
-
const elmDefaultOptions = { cwd: elmSource,
|
7
|
+
const elmDefaultOptions = { cwd: elmSource, pathToElm: elmBinary }
|
8
8
|
const developmentOptions = Object.assign({}, elmDefaultOptions, {
|
9
9
|
verbose: true,
|
10
|
-
warn: true,
|
11
10
|
debug: true
|
12
11
|
})
|
13
12
|
|
@@ -19,5 +18,5 @@ const elmWebpackLoader = {
|
|
19
18
|
module.exports = {
|
20
19
|
test: /\.elm(\.erb)?$/,
|
21
20
|
exclude: [/elm-stuff/, /node_modules/],
|
22
|
-
use: isProduction ? [elmWebpackLoader] : [{ loader: 'elm-hot-loader' }, elmWebpackLoader]
|
21
|
+
use: isProduction ? [elmWebpackLoader] : [{ loader: 'elm-hot-webpack-loader' }, elmWebpackLoader]
|
23
22
|
}
|
data/lib/install/loaders/vue.js
CHANGED
@@ -1,8 +1,3 @@
|
|
1
|
-
const { dev_server: devServer } = require('@rails/webpacker').config
|
2
|
-
|
3
|
-
const isProduction = process.env.NODE_ENV === 'production'
|
4
|
-
const inDevServer = process.argv.find(v => v.includes('webpack-dev-server'))
|
5
|
-
|
6
1
|
module.exports = {
|
7
2
|
test: /\.vue(\.erb)?$/,
|
8
3
|
use: [{
|
data/lib/install/react.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
require "webpacker/configuration"
|
2
2
|
|
3
3
|
babelrc = Rails.root.join(".babelrc")
|
4
|
+
babel_react_preset = ["@babel/preset-react", { "useBuiltIns": true }]
|
4
5
|
|
5
6
|
if File.exist?(babelrc)
|
6
7
|
react_babelrc = JSON.parse(File.read(babelrc))
|
7
8
|
react_babelrc["presets"] ||= []
|
8
9
|
|
9
|
-
unless react_babelrc["presets"].include?("react")
|
10
|
-
react_babelrc["presets"].push(
|
10
|
+
unless react_babelrc["presets"].flatten.include?("@babel/preset-react")
|
11
|
+
react_babelrc["presets"].push(babel_react_preset)
|
11
12
|
say "Copying react preset to your .babelrc file"
|
12
13
|
|
13
14
|
File.open(babelrc, "w") do |f|
|
@@ -23,9 +24,9 @@ say "Copying react example entry file to #{Webpacker.config.source_entry_path}"
|
|
23
24
|
copy_file "#{__dir__}/examples/react/hello_react.jsx", "#{Webpacker.config.source_entry_path}/hello_react.jsx"
|
24
25
|
|
25
26
|
say "Updating webpack paths to include .jsx file extension"
|
26
|
-
insert_into_file Webpacker.config.config_path, "
|
27
|
+
insert_into_file Webpacker.config.config_path, "- .jsx\n".indent(4), after: /extensions:\n/
|
27
28
|
|
28
29
|
say "Installing all react dependencies"
|
29
|
-
run "yarn add react react-dom babel
|
30
|
+
run "yarn add react react-dom @babel/preset-react prop-types"
|
30
31
|
|
31
32
|
say "Webpacker now supports react.js 🎉", :green
|
data/lib/install/template.rb
CHANGED
@@ -10,26 +10,18 @@ copy_file "#{__dir__}/config/.postcssrc.yml", ".postcssrc.yml"
|
|
10
10
|
say "Copying .babelrc to app root directory"
|
11
11
|
copy_file "#{__dir__}/config/.babelrc", ".babelrc"
|
12
12
|
|
13
|
-
say "
|
14
|
-
|
13
|
+
say "Copying .browserslistrc to app root directory"
|
14
|
+
copy_file "#{__dir__}/config/.browserslistrc", ".browserslistrc"
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
say "Adding configurations"
|
19
|
-
|
20
|
-
check_yarn_integrity_config = ->(value) { <<CONFIG }
|
21
|
-
# Verifies that versions and hashed value of the package contents in the project's package.json
|
22
|
-
config.webpacker.check_yarn_integrity = #{value}
|
23
|
-
CONFIG
|
24
|
-
|
25
|
-
if Rails::VERSION::MAJOR >= 5
|
26
|
-
environment check_yarn_integrity_config.call("true"), env: :development
|
27
|
-
environment check_yarn_integrity_config.call("false"), env: :production
|
16
|
+
if Dir.exists?(Webpacker.config.source_path)
|
17
|
+
say "The JavaScript app source directory already exists"
|
28
18
|
else
|
29
|
-
|
30
|
-
|
19
|
+
say "Creating JavaScript app source directory"
|
20
|
+
directory "#{__dir__}/javascript", Webpacker.config.source_path
|
31
21
|
end
|
32
22
|
|
23
|
+
apply "#{__dir__}/binstubs.rb"
|
24
|
+
|
33
25
|
if File.exists?(".gitignore")
|
34
26
|
append_to_file ".gitignore", <<-EOS
|
35
27
|
/public/packs
|
@@ -40,8 +32,13 @@ yarn-debug.log*
|
|
40
32
|
EOS
|
41
33
|
end
|
42
34
|
|
43
|
-
|
44
|
-
|
35
|
+
if Webpacker::VERSION == /^[0-9]+\.[0-9]+\.[0-9]+$/
|
36
|
+
say "Installing all JavaScript dependencies [#{Webpacker::VERSION}]"
|
37
|
+
run "yarn add @rails/webpacker"
|
38
|
+
else
|
39
|
+
say "Installing all JavaScript dependencies [from prerelease rails/webpacker]"
|
40
|
+
run "yarn add https://github.com/rails/webpacker"
|
41
|
+
end
|
45
42
|
|
46
43
|
say "Installing dev server for live reloading"
|
47
44
|
run "yarn add --dev webpack-dev-server"
|
@@ -50,7 +47,7 @@ if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR > 1
|
|
50
47
|
say "You need to allow webpack-dev-server host as allowed origin for connect-src.", :yellow
|
51
48
|
say "This can be done in Rails 5.2+ for development environment in the CSP initializer", :yellow
|
52
49
|
say "config/initializers/content_security_policy.rb with a snippet like this:", :yellow
|
53
|
-
say "
|
50
|
+
say "policy.connect_src :self, :https, \"http://localhost:3035\", \"ws://localhost:3035\" if Rails.env.development?", :yellow
|
54
51
|
end
|
55
52
|
|
56
53
|
say "Webpacker successfully installed 🎉 🍰", :green
|