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
@@ -83,7 +83,7 @@ dev_server:
83
83
  use_local_ip: false
84
84
  ```
85
85
 
86
- into the these custom configuration:
86
+ into these custom configuration:
87
87
 
88
88
  ```yaml
89
89
  dev_server:
@@ -108,7 +108,7 @@ file in your app root with standard plugins.
108
108
  ```yml
109
109
  plugins:
110
110
  postcss-import: {}
111
- postcss-cssnext: {}
111
+ postcss-preset-env: {}
112
112
  ```
113
113
 
114
114
  ## Using CSS with [vue-loader](https://github.com/vuejs/vue-loader)
@@ -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-preset](https://github.com/babel/babel-preset-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 `babel-polyfill` in your main entry point like so:
22
+ Don't forget to import `@babel/polyfill` in your main entry point like so:
23
23
 
24
24
  ```js
25
- import "babel-polyfill"
25
+ import "@babel/polyfill"
26
26
  ```
27
27
 
28
28
 
29
- ## Module import() vs require()
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.
@@ -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.set('istanbul-instrumenter', {
37
+ environment.loaders.append('istanbul-instrumenter', {
38
38
  test: /\.ts$/,
39
39
  enforce: "post",
40
40
  loader: "istanbul-instrumenter-loader",
@@ -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.)
@@ -2,7 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  gem "webpacker", path: ".."
4
4
 
5
- gem "rails", "~> 4.2"
5
+ gem "rails", "~> 4.2.0"
6
6
  gem "rake", ">= 11.1"
7
7
  gem "rubocop", ">= 0.49", require: false
8
8
  gem "rack-proxy", require: false
@@ -2,7 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  gem "webpacker", path: ".."
4
4
 
5
- gem "rails", "~> 5.0"
5
+ gem "rails", "~> 5.0.0"
6
6
  gem "rake", ">= 11.1"
7
7
  gem "rubocop", ">= 0.49", require: false
8
8
  gem "rack-proxy", require: false
@@ -2,7 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  gem "webpacker", path: ".."
4
4
 
5
- gem "rails", "~> 5.1"
5
+ gem "rails", "~> 5.1.0"
6
6
  gem "rake", ">= 11.1"
7
7
  gem "rubocop", ">= 0.49", require: false
8
8
  gem "rack-proxy", require: false
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "webpacker", path: ".."
4
+
5
+ gem "rails", "~> 5.2.0"
6
+ gem "rake", ">= 11.1"
7
+ gem "rubocop", ">= 0.49", require: false
8
+ gem "rack-proxy", require: false
9
+ gem "minitest", "~> 5.0"
10
+ gem "byebug"
@@ -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 " p.script_src :self, :https, :unsafe_eval", :yellow
17
+ say " policy.script_src :self, :https, :unsafe_eval", :yellow
18
18
  say "else", :yellow
19
- say " p.script_src :self, :https", :yellow
19
+ say " policy.script_src :self, :https", :yellow
20
20
  say "end", :yellow
21
21
  end
22
22
 
@@ -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"] ||= ENV["NODE_ENV"] || "development"
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
- Webpacker::WebpackRunner.run(ARGV)
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"] ||= ENV["NODE_ENV"] || "development"
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
- Webpacker::DevServerRunner.run(ARGV)
15
+
16
+ APP_ROOT = File.expand_path("..", __dir__)
17
+ Dir.chdir(APP_ROOT) do
18
+ Webpacker::DevServerRunner.run(ARGV)
19
+ end
@@ -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, " - .coffee\n", after: /extensions:\n/
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",
@@ -1,18 +1,41 @@
1
1
  {
2
2
  "presets": [
3
- ["env", {
4
- "modules": false,
5
- "targets": {
6
- "browsers": "> 1%",
7
- "uglify": true
8
- },
9
- "useBuiltIns": true
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
- "syntax-dynamic-import",
15
- "transform-object-rest-spread",
16
- ["transform-class-properties", { "spec": true }]
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%
@@ -1,3 +1,3 @@
1
1
  plugins:
2
2
  postcss-import: {}
3
- postcss-cssnext: {}
3
+ postcss-preset-env: {}
@@ -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
@@ -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 package install -- --yes"
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, " - .elm\n", after: /extensions:\n/
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-package.json", /\"\.\"\n/,
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"
@@ -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, " - .erb\n", after: /extensions:\n/
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
- ["env", { "modules": false } ],
4
- "react"
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 { Application } from "stimulus"
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))
@@ -6,6 +6,10 @@
6
6
  "lib": ["es6", "dom"],
7
7
  "module": "es6",
8
8
  "moduleResolution": "node",
9
+ "baseUrl": ".",
10
+ "paths": {
11
+ "*": ["node_modules/*", "app/javascript/*"]
12
+ },
9
13
  "sourceMap": true,
10
14
  "target": "es5"
11
15
  },
@@ -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
  //
@@ -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 elmMake = `${elmSource}/node_modules/.bin/elm-make`
5
+ const elmBinary = `${elmSource}/node_modules/.bin/elm`
6
6
 
7
- const elmDefaultOptions = { cwd: elmSource, pathToMake: elmMake }
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
  }
@@ -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: [{
@@ -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("react")
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, " - .jsx\n", after: /extensions:\n/
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-preset-react prop-types"
30
+ run "yarn add react react-dom @babel/preset-react prop-types"
30
31
 
31
32
  say "Webpacker now supports react.js 🎉", :green
@@ -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 "Creating JavaScript app source directory"
14
- directory "#{__dir__}/javascript", Webpacker.config.source_path
13
+ say "Copying .browserslistrc to app root directory"
14
+ copy_file "#{__dir__}/config/.browserslistrc", ".browserslistrc"
15
15
 
16
- apply "#{__dir__}/binstubs.rb"
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
- inject_into_file "config/environments/development.rb", "\n #{check_yarn_integrity_config.call("true")}", after: "Rails.application.configure do", verbose: false
30
- inject_into_file "config/environments/production.rb", "\n #{check_yarn_integrity_config.call("false")}", after: "Rails.application.configure do", verbose: false
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
- say "Installing all JavaScript dependencies"
44
- run "yarn add @rails/webpacker"
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 "p.connect_src :self, :https, \"http://localhost:3035\", \"ws://localhost:3035\" if Rails.env.development?", :yellow
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