webpacker 3.0.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintignore +1 -0
  3. data/.travis.yml +10 -0
  4. data/CHANGELOG.md +110 -0
  5. data/Gemfile.lock +69 -67
  6. data/MIT-LICENSE +1 -1
  7. data/README.md +86 -30
  8. data/docs/assets.md +4 -4
  9. data/docs/cloud9.md +310 -0
  10. data/docs/css.md +32 -3
  11. data/docs/deployment.md +42 -4
  12. data/docs/docker.md +49 -0
  13. data/docs/env.md +5 -5
  14. data/docs/folder-structure.md +2 -2
  15. data/docs/testing.md +14 -34
  16. data/docs/troubleshooting.md +40 -4
  17. data/docs/typescript.md +2 -2
  18. data/docs/webpack-dev-server.md +21 -4
  19. data/docs/webpack.md +103 -25
  20. data/gemfiles/Gemfile-rails-edge +13 -0
  21. data/gemfiles/Gemfile-rails.4.2.x +10 -0
  22. data/gemfiles/Gemfile-rails.5.0.x +10 -0
  23. data/gemfiles/Gemfile-rails.5.1.x +10 -0
  24. data/lib/install/angular.rb +5 -5
  25. data/lib/install/config/webpacker.yml +7 -0
  26. data/lib/install/elm.rb +7 -7
  27. data/lib/install/examples/vue/hello_vue.js +30 -4
  28. data/lib/install/react.rb +5 -5
  29. data/lib/install/template.rb +19 -9
  30. data/lib/install/vue.rb +4 -4
  31. data/lib/tasks/installers.rake +2 -2
  32. data/lib/tasks/webpacker.rake +7 -6
  33. data/lib/tasks/webpacker/check_binstubs.rake +3 -3
  34. data/lib/tasks/webpacker/compile.rake +15 -8
  35. data/lib/tasks/webpacker/install.rake +4 -4
  36. data/lib/tasks/webpacker/verify_install.rake +1 -1
  37. data/lib/webpacker/compiler.rb +6 -6
  38. data/lib/webpacker/dev_server.rb +2 -2
  39. data/lib/webpacker/dev_server_proxy.rb +2 -1
  40. data/lib/webpacker/dev_server_runner.rb +4 -4
  41. data/lib/webpacker/helper.rb +3 -3
  42. data/lib/webpacker/manifest.rb +2 -2
  43. data/lib/webpacker/railtie.rb +41 -2
  44. data/lib/webpacker/runner.rb +1 -1
  45. data/lib/webpacker/version.rb +1 -1
  46. data/package.json +29 -21
  47. data/package/asset_host.js +4 -5
  48. data/package/config.js +7 -1
  49. data/package/config_types/__tests__/config_list.js +123 -0
  50. data/package/config_types/__tests__/config_object.js +43 -0
  51. data/package/config_types/config_list.js +83 -0
  52. data/package/config_types/config_object.js +55 -0
  53. data/package/config_types/index.js +7 -0
  54. data/package/environment.js +64 -40
  55. data/package/environments/development.js +31 -34
  56. data/package/environments/production.js +14 -11
  57. data/package/index.js +7 -2
  58. data/package/{loaders → rules}/babel.js +6 -4
  59. data/package/{loaders → rules}/coffee.js +3 -1
  60. data/package/rules/css.js +39 -0
  61. data/package/rules/elm.js +23 -0
  62. data/package/rules/erb.js +11 -0
  63. data/package/{loaders → rules}/file.js +1 -1
  64. data/package/rules/index.js +23 -0
  65. data/package/rules/sass.js +15 -0
  66. data/package/{loaders → rules}/typescript.js +3 -1
  67. data/package/rules/url.js +13 -0
  68. data/package/rules/vue.js +13 -0
  69. data/package/utils/__tests__/deep_assign.js +11 -0
  70. data/package/utils/__tests__/deep_merge.js +10 -0
  71. data/package/utils/__tests__/objectify.js +9 -0
  72. data/package/utils/deep_assign.js +22 -0
  73. data/package/utils/deep_merge.js +23 -0
  74. data/package/utils/helpers.js +32 -0
  75. data/package/utils/objectify.js +4 -0
  76. data/test/command_test.rb +1 -1
  77. data/test/compiler_test.rb +5 -1
  78. data/test/configuration_test.rb +1 -1
  79. data/test/dev_server_test.rb +1 -1
  80. data/test/helper_test.rb +15 -10
  81. data/test/manifest_test.rb +1 -1
  82. data/test/rake_tasks_test.rb +29 -0
  83. data/test/test_app/Rakefile +3 -0
  84. data/test/test_app/config/application.rb +11 -0
  85. data/test/test_app/config/environment.rb +4 -0
  86. data/test/{webpacker_test_helper.rb → test_helper.rb} +3 -14
  87. data/webpacker.gemspec +1 -1
  88. data/yarn.lock +1552 -829
  89. metadata +43 -16
  90. data/package/loaders/elm.js +0 -19
  91. data/package/loaders/erb.js +0 -9
  92. data/package/loaders/style.js +0 -31
  93. data/package/loaders/vue.js +0 -12
  94. data/test/test_app/config/secrets.yml +0 -5
@@ -0,0 +1,13 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
4
+
5
+ gem "webpacker", path: ".."
6
+
7
+ gem "rails", github: "rails/rails"
8
+ gem "arel", github: "rails/arel"
9
+ gem "rake", ">= 11.1"
10
+ gem "rubocop", ">= 0.49", require: false
11
+ gem "rack-proxy", require: false
12
+ gem "minitest", "~> 5.0"
13
+ gem "byebug"
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "webpacker", path: ".."
4
+
5
+ gem "rails", "~> 4.2"
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"
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "webpacker", path: ".."
4
+
5
+ gem "rails", "~> 5.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"
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "webpacker", path: ".."
4
+
5
+ gem "rails", "~> 5.1"
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"
@@ -1,15 +1,15 @@
1
1
  require "webpacker/configuration"
2
2
 
3
- puts "Copying angular example entry file to #{Webpacker.config.source_entry_path}"
3
+ say "Copying angular example entry file to #{Webpacker.config.source_entry_path}"
4
4
  copy_file "#{__dir__}/examples/angular/hello_angular.js", "#{Webpacker.config.source_entry_path}/hello_angular.js"
5
5
 
6
- puts "Copying hello_angular app to #{Webpacker.config.source_path}"
6
+ say "Copying hello_angular app to #{Webpacker.config.source_path}"
7
7
  directory "#{__dir__}/examples/angular/hello_angular", "#{Webpacker.config.source_path}/hello_angular"
8
8
 
9
- puts "Copying tsconfig.json to the Rails root directory for typescript"
9
+ say "Copying tsconfig.json to the Rails root directory for typescript"
10
10
  copy_file "#{__dir__}/examples/angular/tsconfig.json", "tsconfig.json"
11
11
 
12
- puts "Installing all angular dependencies"
12
+ say "Installing all angular dependencies"
13
13
  run "yarn add typescript ts-loader core-js zone.js rxjs @angular/core @angular/common @angular/compiler @angular/platform-browser @angular/platform-browser-dynamic"
14
14
 
15
- puts "Webpacker now supports angular and typescript 🎉"
15
+ say "Webpacker now supports angular and typescript 🎉", :green
@@ -43,8 +43,15 @@ development:
43
43
  # Inline should be set to true if using HMR
44
44
  inline: true
45
45
  overlay: true
46
+ compress: true
46
47
  disable_host_check: true
47
48
  use_local_ip: false
49
+ quiet: false
50
+ headers:
51
+ 'Access-Control-Allow-Origin': '*'
52
+ watch_options:
53
+ ignored: /node_modules/
54
+
48
55
 
49
56
  test:
50
57
  <<: *default
data/lib/install/elm.rb CHANGED
@@ -1,26 +1,26 @@
1
1
  require "webpacker/configuration"
2
2
 
3
- puts "Copying Elm example entry file to #{Webpacker.config.source_entry_path}"
3
+ say "Copying Elm example entry file to #{Webpacker.config.source_entry_path}"
4
4
  copy_file "#{__dir__}/examples/elm/hello_elm.js",
5
5
  "#{Webpacker.config.source_entry_path}/hello_elm.js"
6
6
 
7
- puts "Copying Elm app file to #{Webpacker.config.source_path}"
7
+ say "Copying Elm app file to #{Webpacker.config.source_path}"
8
8
  copy_file "#{__dir__}/examples/elm/Main.elm",
9
9
  "#{Webpacker.config.source_path}/Main.elm"
10
10
 
11
- puts "Installing all Elm dependencies"
11
+ say "Installing all Elm dependencies"
12
12
  run "yarn add elm elm-webpack-loader"
13
13
  run "yarn add --dev elm-hot-loader"
14
14
  run "yarn run elm package install -- --yes"
15
15
 
16
- puts "Updating Webpack paths to include Elm file extension"
16
+ say "Updating webpack paths to include Elm file extension"
17
17
  insert_into_file Webpacker.config.config_path, " - .elm\n", after: /extensions:\n/
18
18
 
19
- puts "Updating Elm source location"
19
+ say "Updating Elm source location"
20
20
  gsub_file "elm-package.json", /\"\.\"\n/,
21
21
  %("#{Webpacker.config.source_path.relative_path_from(Rails.root)}"\n)
22
22
 
23
- puts "Updating .gitignore to include elm-stuff folder"
23
+ say "Updating .gitignore to include elm-stuff folder"
24
24
  insert_into_file ".gitignore", "/elm-stuff\n", before: "/node_modules\n"
25
25
 
26
- puts "Webpacker now supports Elm 🎉"
26
+ say "Webpacker now supports Elm 🎉", :green
@@ -1,7 +1,7 @@
1
1
  /* eslint no-console: 0 */
2
2
  // Run this example by adding <%= javascript_pack_tag 'hello_vue' %> (and
3
- // <%= stylesheet_pack_tag 'hello_vue' %> if you set extractStyles to true
4
- // in config/webpack/loaders/vue.js) to the head of your layout file,
3
+ // <%= stylesheet_pack_tag 'hello_vue' %> if you have styles in your component)
4
+ // to the head of your layout file,
5
5
  // like app/views/layouts/application.html.erb.
6
6
  // All it does is render <div>Hello Vue</div> at the bottom of the page.
7
7
 
@@ -10,7 +10,9 @@ import App from '../app.vue'
10
10
 
11
11
  document.addEventListener('DOMContentLoaded', () => {
12
12
  document.body.appendChild(document.createElement('hello'))
13
- const app = new Vue(App).$mount('hello')
13
+ const app = new Vue({
14
+ render: h => h(App)
15
+ }).$mount('hello')
14
16
 
15
17
  console.log(app)
16
18
  })
@@ -31,7 +33,7 @@ document.addEventListener('DOMContentLoaded', () => {
31
33
 
32
34
 
33
35
  // import Vue from 'vue/dist/vue.esm'
34
- // import App from './app.vue'
36
+ // import App from '../app.vue'
35
37
  //
36
38
  // document.addEventListener('DOMContentLoaded', () => {
37
39
  // const app = new Vue({
@@ -42,3 +44,27 @@ document.addEventListener('DOMContentLoaded', () => {
42
44
  // components: { App }
43
45
  // })
44
46
  // })
47
+ //
48
+ //
49
+ //
50
+ // If the using turbolinks, install 'vue-turbolinks':
51
+ //
52
+ // yarn add 'vue-turbolinks'
53
+ //
54
+ // Then uncomment the code block below:
55
+ //
56
+ // import TurbolinksAdapter from 'vue-turbolinks';
57
+ // import Vue from 'vue/dist/vue.esm'
58
+ // import App from '../app.vue'
59
+ //
60
+ // Vue.use(TurbolinksAdapter)
61
+ //
62
+ // document.addEventListener('turbolinks:load', () => {
63
+ // const app = new Vue({
64
+ // el: '#hello',
65
+ // data: {
66
+ // message: "Can you say hello?"
67
+ // },
68
+ // components: { App }
69
+ // })
70
+ // })
data/lib/install/react.rb CHANGED
@@ -8,21 +8,21 @@ if File.exist?(babelrc)
8
8
 
9
9
  unless react_babelrc["presets"].include?("react")
10
10
  react_babelrc["presets"].push("react")
11
- puts "Copying react preset to your .babelrc file"
11
+ say "Copying react preset to your .babelrc file"
12
12
 
13
13
  File.open(babelrc, "w") do |f|
14
14
  f.puts JSON.pretty_generate(react_babelrc)
15
15
  end
16
16
  end
17
17
  else
18
- puts "Copying .babelrc to app root directory"
18
+ say "Copying .babelrc to app root directory"
19
19
  copy_file "#{__dir__}/examples/react/.babelrc", ".babelrc"
20
20
  end
21
21
 
22
- puts "Copying react example entry file to #{Webpacker.config.source_entry_path}"
22
+ say "Copying react example entry file to #{Webpacker.config.source_entry_path}"
23
23
  copy_file "#{__dir__}/examples/react/hello_react.jsx", "#{Webpacker.config.source_entry_path}/hello_react.jsx"
24
24
 
25
- puts "Installing all react dependencies"
25
+ say "Installing all react dependencies"
26
26
  run "yarn add react react-dom babel-preset-react prop-types"
27
27
 
28
- puts "Webpacker now supports react.js 🎉"
28
+ say "Webpacker now supports react.js 🎉", :green
@@ -1,21 +1,31 @@
1
- # Install webpacker
1
+ # Install Webpacker
2
2
  copy_file "#{__dir__}/config/webpacker.yml", "config/webpacker.yml"
3
3
 
4
- puts "Copying webpack core config and loaders"
4
+ puts "Copying webpack core config"
5
5
  directory "#{__dir__}/config/webpack", "config/webpack"
6
6
 
7
- puts "Copying .postcssrc.yml to app root directory"
7
+ say "Copying .postcssrc.yml to app root directory"
8
8
  copy_file "#{__dir__}/config/.postcssrc.yml", ".postcssrc.yml"
9
9
 
10
- puts "Copying .babelrc to app root directory"
10
+ say "Copying .babelrc to app root directory"
11
11
  copy_file "#{__dir__}/config/.babelrc", ".babelrc"
12
12
 
13
- puts "Creating javascript app source directory"
13
+ say "Creating JavaScript app source directory"
14
14
  directory "#{__dir__}/javascript", Webpacker.config.source_path
15
15
 
16
- puts "Installing binstubs"
16
+ say "Installing binstubs"
17
17
  run "bundle binstubs webpacker"
18
18
 
19
+ say "Adding configurations"
20
+ environment <<CONFIG, env: :development
21
+ # Verifies that versions and hashed value of the package contents in the project's package.json
22
+ config.webpacker.check_yarn_integrity = true
23
+ CONFIG
24
+ environment <<CONFIG, env: :production
25
+ # Verifies that versions and hashed value of the package contents in the project's package.json
26
+ config.webpacker.check_yarn_integrity = false
27
+ CONFIG
28
+
19
29
  if File.exists?(".gitignore")
20
30
  append_to_file ".gitignore", <<-EOS
21
31
  /public/packs
@@ -24,10 +34,10 @@ if File.exists?(".gitignore")
24
34
  EOS
25
35
  end
26
36
 
27
- puts "Installing all JavaScript dependencies"
37
+ say "Installing all JavaScript dependencies"
28
38
  run "yarn add @rails/webpacker coffeescript@1.12.7"
29
39
 
30
- puts "Installing dev server for live reloading"
40
+ say "Installing dev server for live reloading"
31
41
  run "yarn add --dev webpack-dev-server"
32
42
 
33
- puts "Webpacker successfully installed 🎉 🍰"
43
+ say "Webpacker successfully installed 🎉 🍰", :green
data/lib/install/vue.rb CHANGED
@@ -1,14 +1,14 @@
1
1
  require "webpacker/configuration"
2
2
 
3
- puts "Copying the example entry file to #{Webpacker.config.source_entry_path}"
3
+ say "Copying the example entry file to #{Webpacker.config.source_entry_path}"
4
4
  copy_file "#{__dir__}/examples/vue/hello_vue.js",
5
5
  "#{Webpacker.config.source_entry_path}/hello_vue.js"
6
6
 
7
- puts "Copying Vue app file to #{Webpacker.config.source_entry_path}"
7
+ say "Copying Vue app file to #{Webpacker.config.source_entry_path}"
8
8
  copy_file "#{__dir__}/examples/vue/app.vue",
9
9
  "#{Webpacker.config.source_path}/app.vue"
10
10
 
11
- puts "Installing all Vue dependencies"
11
+ say "Installing all Vue dependencies"
12
12
  run "yarn add vue vue-loader vue-template-compiler"
13
13
 
14
- puts "Webpacker now supports Vue.js 🎉"
14
+ say "Webpacker now supports Vue.js 🎉", :green
@@ -1,4 +1,4 @@
1
- INSTALLERS = {
1
+ installers = {
2
2
  "Angular": :angular,
3
3
  "Elm": :elm,
4
4
  "React": :react,
@@ -7,7 +7,7 @@ INSTALLERS = {
7
7
 
8
8
  namespace :webpacker do
9
9
  namespace :install do
10
- INSTALLERS.each do |name, task_name|
10
+ installers.each do |name, task_name|
11
11
  desc "Install everything needed for #{name}"
12
12
  task task_name => ["webpacker:verify_install"] do
13
13
  template = File.expand_path("../install/#{task_name}.rb", __dir__)
@@ -1,10 +1,11 @@
1
1
  tasks = {
2
- "webpacker:install" => "Installs and setup webpack with yarn",
2
+ "webpacker:install" => "Installs and setup webpack with Yarn",
3
3
  "webpacker:compile" => "Compiles webpack bundles based on environment",
4
+ "webpacker:clobber" => "Removes the webpack compiled output directory",
4
5
  "webpacker:check_node" => "Verifies if Node.js is installed",
5
- "webpacker:check_yarn" => "Verifies if yarn is installed",
6
- "webpacker:check_binstubs" => "Verifies that bin/webpack & bin/webpack-dev-server are present",
7
- "webpacker:verify_install" => "Verifies if webpacker is installed",
6
+ "webpacker:check_yarn" => "Verifies if Yarn is installed",
7
+ "webpacker:check_binstubs" => "Verifies that webpack & webpack-dev-server are present",
8
+ "webpacker:verify_install" => "Verifies if Webpacker is installed",
8
9
  "webpacker:yarn_install" => "Support for older Rails versions. Install all JavaScript dependencies as specified via Yarn",
9
10
  "webpacker:install:react" => "Installs and setup example React component",
10
11
  "webpacker:install:vue" => "Installs and setup example Vue component",
@@ -12,8 +13,8 @@ tasks = {
12
13
  "webpacker:install:elm" => "Installs and setup example Elm component"
13
14
  }.freeze
14
15
 
15
- desc "Lists all available tasks in webpacker"
16
+ desc "Lists all available tasks in Webpacker"
16
17
  task :webpacker do
17
- puts "Available webpacker tasks are:"
18
+ puts "Available Webpacker tasks are:"
18
19
  tasks.each { |task, message| puts task.ljust(30) + message }
19
20
  end
@@ -1,8 +1,8 @@
1
1
  namespace :webpacker do
2
- desc "Verifies that bin/webpack & bin/webpack-dev-server are present."
2
+ desc "Verifies that webpack & webpack-dev-server are present."
3
3
  task :check_binstubs do
4
- unless File.exist?("bin/webpack") && File.exist?("bin/webpack-dev-server")
5
- $stderr.puts "Webpack binstubs not found.\n"\
4
+ unless Bundler.which("webpack")
5
+ $stderr.puts "webpack binstubs not found.\n"\
6
6
  "Have you run rails webpacker:install ?\n"\
7
7
  "Make sure the bin directory or binstubs are not included in .gitignore\n"\
8
8
  "Exiting!"
@@ -8,8 +8,18 @@ ensure
8
8
  Webpacker.logger = old_logger
9
9
  end
10
10
 
11
+ def enhance_assets_precompile
12
+ Rake::Task["assets:precompile"].enhance do
13
+ unless Rake::Task.task_defined?("yarn:install")
14
+ # For Rails < 5.1
15
+ Rake::Task["webpacker:yarn_install"].invoke
16
+ end
17
+ Rake::Task["webpacker:compile"].invoke
18
+ end
19
+ end
20
+
11
21
  namespace :webpacker do
12
- desc "Compile javascript packs using webpack for production with digests"
22
+ desc "Compile JavaScript packs using webpack for production with digests"
13
23
  task compile: ["webpacker:verify_install", :environment] do
14
24
  ensure_log_goes_to_stdout do
15
25
  if Webpacker.compile
@@ -24,11 +34,8 @@ end
24
34
 
25
35
  # Compile packs after we've compiled all other assets during precompilation
26
36
  if Rake::Task.task_defined?("assets:precompile")
27
- Rake::Task["assets:precompile"].enhance do
28
- unless Rake::Task.task_defined?("yarn:install")
29
- # For Rails < 5.1
30
- Rake::Task["webpacker:yarn_install"].invoke
31
- end
32
- Rake::Task["webpacker:compile"].invoke
33
- end
37
+ skip_webpacker_precompile = %w(no false n f).include?(ENV["WEBPACKER_PRECOMPILE"])
38
+ enhance_assets_precompile unless skip_webpacker_precompile
39
+ else
40
+ Rake::Task.define_task("assets:precompile" => ["webpacker:compile"])
34
41
  end
@@ -1,12 +1,12 @@
1
- WEBPACKER_APP_TEMPLATE_PATH = File.expand_path("../../install/template.rb", __dir__)
1
+ install_template_path = File.expand_path("../../install/template.rb", __dir__).freeze
2
2
 
3
3
  namespace :webpacker do
4
- desc "Install webpacker in this application"
4
+ desc "Install Webpacker in this application"
5
5
  task install: [:check_node, :check_yarn] do
6
6
  if Rails::VERSION::MAJOR >= 5
7
- exec "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{WEBPACKER_APP_TEMPLATE_PATH}"
7
+ exec "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{install_template_path}"
8
8
  else
9
- exec "#{RbConfig.ruby} ./bin/rake rails:template LOCATION=#{WEBPACKER_APP_TEMPLATE_PATH}"
9
+ exec "#{RbConfig.ruby} ./bin/rake rails:template LOCATION=#{install_template_path}"
10
10
  end
11
11
  end
12
12
  end
@@ -1,7 +1,7 @@
1
1
  require "webpacker/configuration"
2
2
 
3
3
  namespace :webpacker do
4
- desc "Verifies if webpacker is installed"
4
+ desc "Verifies if Webpacker is installed"
5
5
  task verify_install: [:check_node, :check_yarn, :check_binstubs] do
6
6
  if Webpacker.config.config_path.exist?
7
7
  $stdout.puts "Webpacker is installed 🎉 🍰"
@@ -3,12 +3,12 @@ require "digest/sha1"
3
3
 
4
4
  class Webpacker::Compiler
5
5
  # Additional paths that test compiler needs to watch
6
- # Webpacker::Compiler.watched_paths << 'bower_components'
7
- mattr_accessor(:watched_paths) { [] }
6
+ # Webpacker::Compiler.watched_paths << 'bower_components'
7
+ cattr_accessor(:watched_paths) { [] }
8
8
 
9
9
  # Additional environment variables that the compiler is being run with
10
10
  # Webpacker::Compiler.env['FRONTEND_API_KEY'] = 'your_secret_key'
11
- mattr_accessor(:env) { {} }
11
+ cattr_accessor(:env) { {} }
12
12
 
13
13
  delegate :config, :logger, to: :@webpacker
14
14
 
@@ -53,7 +53,7 @@ class Webpacker::Compiler
53
53
  def run_webpack
54
54
  logger.info "Compiling…"
55
55
 
56
- sterr, stdout, status = Open3.capture3(webpack_env, "#{RbConfig.ruby} ./bin/webpack")
56
+ sterr, stdout, status = Open3.capture3(webpack_env, "bundle exec webpack")
57
57
 
58
58
  if status.success?
59
59
  logger.info "Compiled all packs in #{config.public_output_path}"
@@ -69,10 +69,10 @@ class Webpacker::Compiler
69
69
  end
70
70
 
71
71
  def compilation_digest_path
72
- config.cache_path.join(".last-compilation-digest")
72
+ config.cache_path.join(".last-compilation-digest-#{Webpacker.env}")
73
73
  end
74
74
 
75
75
  def webpack_env
76
- env.merge("NODE_ENV" => @webpacker.env, "ASSET_HOST" => ActionController::Base.helpers.compute_asset_host)
76
+ env.merge("NODE_ENV" => @webpacker.env, "WEBPACKER_ASSET_HOST" => ActionController::Base.helpers.compute_asset_host)
77
77
  end
78
78
  end
@@ -1,7 +1,7 @@
1
1
  class Webpacker::DevServer
2
2
  # Configure dev server connection timeout (in seconds), default: 0.01
3
- # Webpacker.dev_server.connect_timeout = 1
4
- mattr_accessor(:connect_timeout) { 0.01 }
3
+ # Webpacker.dev_server.connect_timeout = 1
4
+ cattr_accessor(:connect_timeout) { 0.01 }
5
5
 
6
6
  delegate :config, to: :@webpacker
7
7