File tree Expand file tree Collapse file tree 6 files changed +26
-9
lines changed Expand file tree Collapse file tree 6 files changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -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
+ custom_compile : false
8
9
9
10
# Additional paths webpack should lookup modules
10
11
# ['app/assets', 'engine/foo/app/assets']
Original file line number Diff line number Diff line change 1
1
namespace :webpacker do
2
2
desc "Verifies that bin/webpack & bin/webpack-dev-server are present."
3
3
task :check_binstubs do
4
- unless File . exist? ( "bin/webpack" ) && File . exist? ( "bin/webpack-dev-server" )
4
+ unless Webpacker . config . custom_compile? ||
5
+ ( File . exist? ( "bin/webpack" ) && File . exist? ( "bin/webpack-dev-server" ) )
5
6
$stderr. puts "Webpack binstubs not found.\n " \
6
7
"Have you run rails webpacker:install ?\n " \
7
8
"Make sure the bin directory or binstubs are not included in .gitignore\n " \
Original file line number Diff line number Diff line change @@ -3,14 +3,16 @@ require "webpacker/configuration"
3
3
namespace :webpacker do
4
4
desc "Verifies if webpacker is installed"
5
5
task verify_install : [ :check_node , :check_yarn , :check_binstubs ] do
6
- if Webpacker . config . config_path . exist?
7
- $stdout. puts "Webpacker is installed 🎉 🍰"
8
- $stdout. puts "Using #{ Webpacker . config . config_path } file for setting up webpack paths"
9
- else
10
- $stderr. puts "Configuration config/webpacker.yml file not found. \n " \
6
+ unless Webpacker . config . custom_compile?
7
+ if Webpacker . config . config_path . exist?
8
+ $stdout. puts "Webpacker is installed 🎉 🍰"
9
+ $stdout. puts "Using #{ Webpacker . config . config_path } file for setting up webpack paths"
10
+ else
11
+ $stderr. puts "Configuration config/webpacker.yml file not found. \n " \
11
12
"Make sure webpacker:install is run successfully before " \
12
13
"running dependent tasks"
13
- exit!
14
+ exit!
15
+ end
14
16
end
15
17
end
16
18
end
Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ def compile?
17
17
fetch ( :compile )
18
18
end
19
19
20
+ def custom_compile?
21
+ fetch ( :custom_compile )
22
+ end
23
+
20
24
def source_path
21
25
root_path . join ( fetch ( :source_path ) )
22
26
end
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ def find(name)
42
42
43
43
def handle_missing_entry ( name )
44
44
raise Webpacker ::Manifest ::MissingEntryError ,
45
- "Can't find #{ name } in #{ config . public_manifest_path } . Manifest contains: #{ @data } "
45
+ "Can't find #{ name } in #{ config . public_manifest_path } . Manifest contains:\n #{ JSON . pretty_generate ( @data ) } "
46
46
end
47
47
48
48
def missing_file_from_manifest_error ( bundle_name )
Original file line number Diff line number Diff line change @@ -9,8 +9,17 @@ def test_lookup_exception
9
9
error = assert_raises Webpacker ::Manifest ::MissingEntryError do
10
10
Webpacker . manifest . lookup ( asset_file )
11
11
end
12
+ expected = <<-MSG . strip
13
+ Can't find calendar.js in #{ manifest_path } . Manifest contains:
14
+ {
15
+ "bootstrap.css": "/packs/bootstrap-c38deda30895059837cf.css",
16
+ "application.css": "/packs/application-dd6b1cd38bfa093df600.css",
17
+ "bootstrap.js": "/packs/bootstrap-300631c4f0e0f9c865bc.js",
18
+ "application.js": "/packs/application-k344a6d59eef8632c9d1.js"
19
+ }
20
+ MSG
12
21
13
- assert_equal "Can't find #{ asset_file } in #{ manifest_path } . Is webpack still compiling?" , error . message
22
+ assert_equal expected , error . message
14
23
end
15
24
end
16
25
You can’t perform that action at this time.
0 commit comments