webpacker 3.0.2 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintignore +1 -0
- data/.travis.yml +10 -0
- data/CHANGELOG.md +110 -0
- data/Gemfile.lock +69 -67
- data/MIT-LICENSE +1 -1
- data/README.md +86 -30
- data/docs/assets.md +4 -4
- data/docs/cloud9.md +310 -0
- data/docs/css.md +32 -3
- data/docs/deployment.md +42 -4
- data/docs/docker.md +49 -0
- data/docs/env.md +5 -5
- data/docs/folder-structure.md +2 -2
- data/docs/testing.md +14 -34
- data/docs/troubleshooting.md +40 -4
- data/docs/typescript.md +2 -2
- data/docs/webpack-dev-server.md +21 -4
- data/docs/webpack.md +103 -25
- data/gemfiles/Gemfile-rails-edge +13 -0
- data/gemfiles/Gemfile-rails.4.2.x +10 -0
- data/gemfiles/Gemfile-rails.5.0.x +10 -0
- data/gemfiles/Gemfile-rails.5.1.x +10 -0
- data/lib/install/angular.rb +5 -5
- data/lib/install/config/webpacker.yml +7 -0
- data/lib/install/elm.rb +7 -7
- data/lib/install/examples/vue/hello_vue.js +30 -4
- data/lib/install/react.rb +5 -5
- data/lib/install/template.rb +19 -9
- data/lib/install/vue.rb +4 -4
- data/lib/tasks/installers.rake +2 -2
- data/lib/tasks/webpacker.rake +7 -6
- data/lib/tasks/webpacker/check_binstubs.rake +3 -3
- data/lib/tasks/webpacker/compile.rake +15 -8
- data/lib/tasks/webpacker/install.rake +4 -4
- data/lib/tasks/webpacker/verify_install.rake +1 -1
- data/lib/webpacker/compiler.rb +6 -6
- data/lib/webpacker/dev_server.rb +2 -2
- data/lib/webpacker/dev_server_proxy.rb +2 -1
- data/lib/webpacker/dev_server_runner.rb +4 -4
- data/lib/webpacker/helper.rb +3 -3
- data/lib/webpacker/manifest.rb +2 -2
- data/lib/webpacker/railtie.rb +41 -2
- data/lib/webpacker/runner.rb +1 -1
- data/lib/webpacker/version.rb +1 -1
- data/package.json +29 -21
- data/package/asset_host.js +4 -5
- data/package/config.js +7 -1
- data/package/config_types/__tests__/config_list.js +123 -0
- data/package/config_types/__tests__/config_object.js +43 -0
- data/package/config_types/config_list.js +83 -0
- data/package/config_types/config_object.js +55 -0
- data/package/config_types/index.js +7 -0
- data/package/environment.js +64 -40
- data/package/environments/development.js +31 -34
- data/package/environments/production.js +14 -11
- data/package/index.js +7 -2
- data/package/{loaders → rules}/babel.js +6 -4
- data/package/{loaders → rules}/coffee.js +3 -1
- data/package/rules/css.js +39 -0
- data/package/rules/elm.js +23 -0
- data/package/rules/erb.js +11 -0
- data/package/{loaders → rules}/file.js +1 -1
- data/package/rules/index.js +23 -0
- data/package/rules/sass.js +15 -0
- data/package/{loaders → rules}/typescript.js +3 -1
- data/package/rules/url.js +13 -0
- data/package/rules/vue.js +13 -0
- data/package/utils/__tests__/deep_assign.js +11 -0
- data/package/utils/__tests__/deep_merge.js +10 -0
- data/package/utils/__tests__/objectify.js +9 -0
- data/package/utils/deep_assign.js +22 -0
- data/package/utils/deep_merge.js +23 -0
- data/package/utils/helpers.js +32 -0
- data/package/utils/objectify.js +4 -0
- data/test/command_test.rb +1 -1
- data/test/compiler_test.rb +5 -1
- data/test/configuration_test.rb +1 -1
- data/test/dev_server_test.rb +1 -1
- data/test/helper_test.rb +15 -10
- data/test/manifest_test.rb +1 -1
- data/test/rake_tasks_test.rb +29 -0
- data/test/test_app/Rakefile +3 -0
- data/test/test_app/config/application.rb +11 -0
- data/test/test_app/config/environment.rb +4 -0
- data/test/{webpacker_test_helper.rb → test_helper.rb} +3 -14
- data/webpacker.gemspec +1 -1
- data/yarn.lock +1552 -829
- metadata +43 -16
- data/package/loaders/elm.js +0 -19
- data/package/loaders/erb.js +0 -9
- data/package/loaders/style.js +0 -31
- data/package/loaders/vue.js +0 -12
- 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"
|
data/lib/install/angular.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
require "webpacker/configuration"
|
2
2
|
|
3
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
4
|
-
//
|
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(
|
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 '
|
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
|
-
|
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
|
-
|
18
|
+
say "Copying .babelrc to app root directory"
|
19
19
|
copy_file "#{__dir__}/examples/react/.babelrc", ".babelrc"
|
20
20
|
end
|
21
21
|
|
22
|
-
|
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
|
-
|
25
|
+
say "Installing all react dependencies"
|
26
26
|
run "yarn add react react-dom babel-preset-react prop-types"
|
27
27
|
|
28
|
-
|
28
|
+
say "Webpacker now supports react.js 🎉", :green
|
data/lib/install/template.rb
CHANGED
@@ -1,21 +1,31 @@
|
|
1
|
-
# Install
|
1
|
+
# Install Webpacker
|
2
2
|
copy_file "#{__dir__}/config/webpacker.yml", "config/webpacker.yml"
|
3
3
|
|
4
|
-
puts "Copying webpack core config
|
4
|
+
puts "Copying webpack core config"
|
5
5
|
directory "#{__dir__}/config/webpack", "config/webpack"
|
6
6
|
|
7
|
-
|
7
|
+
say "Copying .postcssrc.yml to app root directory"
|
8
8
|
copy_file "#{__dir__}/config/.postcssrc.yml", ".postcssrc.yml"
|
9
9
|
|
10
|
-
|
10
|
+
say "Copying .babelrc to app root directory"
|
11
11
|
copy_file "#{__dir__}/config/.babelrc", ".babelrc"
|
12
12
|
|
13
|
-
|
13
|
+
say "Creating JavaScript app source directory"
|
14
14
|
directory "#{__dir__}/javascript", Webpacker.config.source_path
|
15
15
|
|
16
|
-
|
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
|
-
|
37
|
+
say "Installing all JavaScript dependencies"
|
28
38
|
run "yarn add @rails/webpacker coffeescript@1.12.7"
|
29
39
|
|
30
|
-
|
40
|
+
say "Installing dev server for live reloading"
|
31
41
|
run "yarn add --dev webpack-dev-server"
|
32
42
|
|
33
|
-
|
43
|
+
say "Webpacker successfully installed 🎉 🍰", :green
|
data/lib/install/vue.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require "webpacker/configuration"
|
2
2
|
|
3
|
-
|
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
|
-
|
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
|
-
|
11
|
+
say "Installing all Vue dependencies"
|
12
12
|
run "yarn add vue vue-loader vue-template-compiler"
|
13
13
|
|
14
|
-
|
14
|
+
say "Webpacker now supports Vue.js 🎉", :green
|
data/lib/tasks/installers.rake
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
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
|
-
|
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__)
|
data/lib/tasks/webpacker.rake
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
tasks = {
|
2
|
-
"webpacker:install" => "Installs and setup webpack with
|
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
|
6
|
-
"webpacker:check_binstubs" => "Verifies that
|
7
|
-
"webpacker:verify_install" => "Verifies if
|
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
|
16
|
+
desc "Lists all available tasks in Webpacker"
|
16
17
|
task :webpacker do
|
17
|
-
puts "Available
|
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
|
2
|
+
desc "Verifies that webpack & webpack-dev-server are present."
|
3
3
|
task :check_binstubs do
|
4
|
-
unless
|
5
|
-
$stderr.puts "
|
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
|
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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
1
|
+
install_template_path = File.expand_path("../../install/template.rb", __dir__).freeze
|
2
2
|
|
3
3
|
namespace :webpacker do
|
4
|
-
desc "Install
|
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=#{
|
7
|
+
exec "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{install_template_path}"
|
8
8
|
else
|
9
|
-
exec "#{RbConfig.ruby} ./bin/rake rails:template LOCATION=#{
|
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
|
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 🎉 🍰"
|
data/lib/webpacker/compiler.rb
CHANGED
@@ -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
|
-
#
|
7
|
-
|
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
|
-
|
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, "
|
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, "
|
76
|
+
env.merge("NODE_ENV" => @webpacker.env, "WEBPACKER_ASSET_HOST" => ActionController::Base.helpers.compute_asset_host)
|
77
77
|
end
|
78
78
|
end
|
data/lib/webpacker/dev_server.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class Webpacker::DevServer
|
2
2
|
# Configure dev server connection timeout (in seconds), default: 0.01
|
3
|
-
#
|
4
|
-
|
3
|
+
# Webpacker.dev_server.connect_timeout = 1
|
4
|
+
cattr_accessor(:connect_timeout) { 0.01 }
|
5
5
|
|
6
6
|
delegate :config, to: :@webpacker
|
7
7
|
|