webpacker 5.4.1 → 6.0.0.rc.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +1 -1
  3. data/.github/workflows/jest.yml +5 -2
  4. data/.github/workflows/js-lint.yml +5 -2
  5. data/.github/workflows/rubocop.yml +1 -1
  6. data/.github/workflows/ruby.yml +19 -4
  7. data/.gitignore +2 -0
  8. data/.node-version +1 -1
  9. data/.rubocop.yml +4 -3
  10. data/CHANGELOG.md +24 -6
  11. data/CONTRIBUTING.md +1 -1
  12. data/Gemfile.lock +82 -82
  13. data/README.md +377 -172
  14. data/config/README.md +3 -0
  15. data/config/webpacker.yml +1 -0
  16. data/docs/deployment.md +9 -11
  17. data/docs/developing_webpacker.md +29 -0
  18. data/docs/troubleshooting.md +57 -25
  19. data/docs/v6_upgrade.md +75 -0
  20. data/gemfiles/Gemfile-rails.6.1.x +12 -0
  21. data/lib/install/bin/yarn +18 -0
  22. data/lib/install/config/webpack/base.js +3 -0
  23. data/lib/install/config/webpack/development.js +2 -2
  24. data/lib/install/config/webpack/production.js +2 -2
  25. data/lib/install/config/webpack/test.js +2 -2
  26. data/lib/install/config/webpacker.yml +20 -50
  27. data/lib/install/package.json +17 -0
  28. data/lib/install/{javascript/packs → packs/entrypoints}/application.js +4 -3
  29. data/lib/install/template.rb +54 -28
  30. data/lib/tasks/webpacker/binstubs.rake +6 -4
  31. data/lib/tasks/webpacker/check_binstubs.rake +4 -4
  32. data/lib/tasks/webpacker/check_node.rake +3 -0
  33. data/lib/tasks/webpacker/check_yarn.rake +3 -0
  34. data/lib/tasks/webpacker/clobber.rake +1 -1
  35. data/lib/tasks/webpacker/compile.rake +4 -2
  36. data/lib/tasks/webpacker/info.rake +12 -10
  37. data/lib/tasks/webpacker/install.rake +6 -4
  38. data/lib/tasks/webpacker/verify_config.rake +14 -0
  39. data/lib/tasks/webpacker/verify_install.rake +1 -10
  40. data/lib/tasks/webpacker/yarn_install.rake +9 -7
  41. data/lib/tasks/webpacker.rake +2 -11
  42. data/lib/tasks/yarn.rake +36 -0
  43. data/lib/webpacker/commands.rb +21 -16
  44. data/lib/webpacker/compiler.rb +16 -9
  45. data/lib/webpacker/configuration.rb +8 -32
  46. data/lib/webpacker/dev_server.rb +6 -0
  47. data/lib/webpacker/dev_server_runner.rb +28 -4
  48. data/lib/webpacker/helper.rb +47 -81
  49. data/lib/webpacker/instance.rb +4 -0
  50. data/lib/webpacker/manifest.rb +2 -3
  51. data/lib/webpacker/railtie.rb +1 -2
  52. data/lib/webpacker/runner.rb +1 -1
  53. data/lib/webpacker/version.rb +1 -1
  54. data/lib/webpacker/webpack_runner.rb +6 -0
  55. data/lib/webpacker.rb +1 -1
  56. data/package/__tests__/config.js +5 -37
  57. data/package/__tests__/development.js +14 -15
  58. data/package/__tests__/env.js +16 -4
  59. data/package/__tests__/index.js +9 -0
  60. data/package/__tests__/production.js +6 -6
  61. data/package/__tests__/staging.js +7 -6
  62. data/package/__tests__/test.js +4 -5
  63. data/package/babel/preset.js +54 -0
  64. data/package/config.js +6 -14
  65. data/package/env.js +13 -4
  66. data/package/environments/__tests__/base.js +20 -52
  67. data/package/environments/base.js +68 -128
  68. data/package/environments/development.js +50 -44
  69. data/package/environments/production.js +66 -64
  70. data/package/environments/test.js +2 -2
  71. data/package/index.js +15 -8
  72. data/package/inliningCss.js +7 -0
  73. data/package/rules/babel.js +10 -8
  74. data/package/rules/coffee.js +6 -0
  75. data/package/rules/erb.js +15 -0
  76. data/package/rules/file.js +21 -19
  77. data/package/rules/index.js +16 -18
  78. data/package/rules/less.js +22 -0
  79. data/package/rules/raw.js +5 -0
  80. data/package/rules/sass.js +9 -10
  81. data/package/rules/stylus.js +26 -0
  82. data/package/utils/get_style_rule.js +28 -36
  83. data/package/utils/helpers.js +28 -35
  84. data/package.json +12 -32
  85. data/test/command_test.rb +76 -0
  86. data/test/compiler_test.rb +0 -12
  87. data/test/configuration_test.rb +4 -35
  88. data/test/dev_server_runner_test.rb +36 -6
  89. data/test/engine_rake_tasks_test.rb +39 -0
  90. data/test/helper_test.rb +79 -77
  91. data/test/manifest_test.rb +16 -0
  92. data/test/mounted_app/Rakefile +4 -0
  93. data/test/mounted_app/test/dummy/Rakefile +3 -0
  94. data/test/mounted_app/test/dummy/bin/rails +3 -0
  95. data/test/mounted_app/test/dummy/bin/rake +3 -0
  96. data/test/mounted_app/test/dummy/config/application.rb +10 -0
  97. data/test/mounted_app/test/dummy/config/environment.rb +3 -0
  98. data/test/mounted_app/test/dummy/config/webpacker.yml +75 -0
  99. data/test/mounted_app/test/dummy/config.ru +5 -0
  100. data/test/mounted_app/test/dummy/package.json +7 -0
  101. data/test/rake_tasks_test.rb +1 -10
  102. data/test/test_app/app/{javascript/packs → packs/entrypoints}/application.js +1 -1
  103. data/test/test_app/app/{javascript/packs → packs/entrypoints}/multi_entry.css +0 -0
  104. data/test/test_app/app/{javascript/packs → packs/entrypoints}/multi_entry.js +0 -0
  105. data/test/test_app/config/webpacker.yml +5 -31
  106. data/test/test_app/config/webpacker_other_location.yml +79 -0
  107. data/test/test_app/config/webpacker_public_root.yml +0 -1
  108. data/test/test_app/public/packs/manifest.json +36 -18
  109. data/test/test_app/some.config.js +0 -0
  110. data/test/webpack_runner_test.rb +9 -3
  111. data/test/webpacker_test.rb +17 -0
  112. data/webpacker.gemspec +1 -1
  113. data/yarn.lock +1050 -3966
  114. metadata +59 -91
  115. data/.travis.yml +0 -43
  116. data/docs/assets.md +0 -119
  117. data/docs/cloud9.md +0 -310
  118. data/docs/css.md +0 -308
  119. data/docs/docker.md +0 -68
  120. data/docs/engines.md +0 -213
  121. data/docs/env.md +0 -63
  122. data/docs/es6.md +0 -72
  123. data/docs/folder-structure.md +0 -66
  124. data/docs/integrations.md +0 -220
  125. data/docs/misc.md +0 -23
  126. data/docs/props.md +0 -223
  127. data/docs/target.md +0 -22
  128. data/docs/testing.md +0 -136
  129. data/docs/typescript.md +0 -190
  130. data/docs/v4-upgrade.md +0 -142
  131. data/docs/webpack-dev-server.md +0 -92
  132. data/docs/webpack.md +0 -364
  133. data/docs/yarn.md +0 -23
  134. data/lib/install/angular.rb +0 -23
  135. data/lib/install/coffee.rb +0 -25
  136. data/lib/install/config/.browserslistrc +0 -1
  137. data/lib/install/config/babel.config.js +0 -76
  138. data/lib/install/config/postcss.config.js +0 -12
  139. data/lib/install/config/webpack/environment.js +0 -3
  140. data/lib/install/elm.rb +0 -39
  141. data/lib/install/erb.rb +0 -25
  142. data/lib/install/examples/angular/hello_angular/app/app.component.ts +0 -9
  143. data/lib/install/examples/angular/hello_angular/app/app.module.ts +0 -16
  144. data/lib/install/examples/angular/hello_angular/index.ts +0 -8
  145. data/lib/install/examples/angular/hello_angular/polyfills.ts +0 -73
  146. data/lib/install/examples/angular/hello_angular.js +0 -7
  147. data/lib/install/examples/coffee/hello_coffee.coffee +0 -4
  148. data/lib/install/examples/elm/Main.elm +0 -55
  149. data/lib/install/examples/elm/hello_elm.js +0 -16
  150. data/lib/install/examples/erb/hello_erb.js.erb +0 -6
  151. data/lib/install/examples/react/babel.config.js +0 -93
  152. data/lib/install/examples/react/hello_react.jsx +0 -26
  153. data/lib/install/examples/react/tsconfig.json +0 -21
  154. data/lib/install/examples/stimulus/application.js +0 -1
  155. data/lib/install/examples/stimulus/controllers/hello_controller.js +0 -18
  156. data/lib/install/examples/stimulus/controllers/index.js +0 -9
  157. data/lib/install/examples/svelte/app.svelte +0 -11
  158. data/lib/install/examples/svelte/hello_svelte.js +0 -20
  159. data/lib/install/examples/typescript/hello_typescript.ts +0 -4
  160. data/lib/install/examples/typescript/tsconfig.json +0 -24
  161. data/lib/install/examples/vue/app.vue +0 -22
  162. data/lib/install/examples/vue/hello_vue.js +0 -72
  163. data/lib/install/loaders/coffee.js +0 -6
  164. data/lib/install/loaders/elm.js +0 -25
  165. data/lib/install/loaders/erb.js +0 -11
  166. data/lib/install/loaders/svelte.js +0 -9
  167. data/lib/install/loaders/vue.js +0 -6
  168. data/lib/install/react.rb +0 -18
  169. data/lib/install/stimulus.rb +0 -12
  170. data/lib/install/svelte.rb +0 -29
  171. data/lib/install/typescript.rb +0 -39
  172. data/lib/install/vue.rb +0 -49
  173. data/lib/tasks/installers.rake +0 -42
  174. data/package/config_types/__tests__/config_list.js +0 -118
  175. data/package/config_types/__tests__/config_object.js +0 -43
  176. data/package/config_types/config_list.js +0 -75
  177. data/package/config_types/config_object.js +0 -55
  178. data/package/config_types/index.js +0 -7
  179. data/package/rules/module.css.js +0 -3
  180. data/package/rules/module.sass.js +0 -8
  181. data/package/rules/node_modules.js +0 -22
  182. data/package/utils/__tests__/deep_assign.js +0 -32
  183. data/package/utils/__tests__/deep_merge.js +0 -10
  184. data/package/utils/__tests__/get_style_rule.js +0 -65
  185. data/package/utils/__tests__/objectify.js +0 -9
  186. data/package/utils/deep_assign.js +0 -22
  187. data/package/utils/deep_merge.js +0 -22
  188. data/package/utils/objectify.js +0 -3
@@ -25,6 +25,22 @@ class ManifestTest < Minitest::Test
25
25
  assert_equal Webpacker.manifest.lookup!("bootstrap.js"), "/packs/bootstrap-300631c4f0e0f9c865bc.js"
26
26
  end
27
27
 
28
+ def test_lookup_with_chunks_without_extension_success!
29
+ assert_equal ["/packs/bootstrap-300631c4f0e0f9c865bc.js"], Webpacker.manifest.lookup_pack_with_chunks!("bootstrap", type: :javascript)
30
+ end
31
+
32
+ def test_lookup_with_chunks_with_extension_success!
33
+ assert_equal ["/packs/bootstrap-300631c4f0e0f9c865bc.js"], Webpacker.manifest.lookup_pack_with_chunks!("bootstrap.js", type: :javascript)
34
+ end
35
+
36
+ def test_lookup_with_chunks_without_extension_subdir_success!
37
+ assert_equal ["/packs/print/application-983b6c164a47f7ed49cd.css"], Webpacker.manifest.lookup_pack_with_chunks!("print/application", type: :css)
38
+ end
39
+
40
+ def test_lookup_with_chunks_with_extension_subdir_success!
41
+ assert_equal ["/packs/print/application-983b6c164a47f7ed49cd.css"], Webpacker.manifest.lookup_pack_with_chunks!("print/application.css", type: :css)
42
+ end
43
+
28
44
  def test_lookup_nil
29
45
  assert_nil Webpacker.manifest.lookup("foo.js")
30
46
  end
@@ -0,0 +1,4 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
@@ -0,0 +1,3 @@
1
+ require_relative "config/application"
2
+
3
+ Rails.application.load_tasks
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path("../config/application", __dir__)
3
+ require "rails/commands"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require "rake"
3
+ Rake.application.run
@@ -0,0 +1,10 @@
1
+ require "action_controller/railtie"
2
+ require "action_view/railtie"
3
+ require "webpacker"
4
+
5
+ module TestDummyApp
6
+ class Application < Rails::Application
7
+ config.secret_key_base = "abcdef"
8
+ config.eager_load = true
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ require_relative "application"
2
+
3
+ Rails.application.initialize!
@@ -0,0 +1,75 @@
1
+ # Note: You must restart bin/webpack-dev-server for changes to take effect
2
+
3
+ default: &default
4
+ source_path: app/packs
5
+ source_entry_path: entrypoints
6
+ public_output_path: packs
7
+ cache_path: tmp/webpacker
8
+
9
+ # Additional paths webpack should look up modules
10
+ # ['app/assets', 'engine/foo/app/assets']
11
+ additional_paths:
12
+ - app/assets
13
+ - /etc/yarn
14
+
15
+ # Reload manifest.json on all requests so we reload latest compiled packs
16
+ cache_manifest: false
17
+
18
+ extensions:
19
+ - .js
20
+ - .sass
21
+ - .scss
22
+ - .css
23
+ - .module.sass
24
+ - .module.scss
25
+ - .module.css
26
+ - .png
27
+ - .svg
28
+ - .gif
29
+ - .jpeg
30
+ - .jpg
31
+
32
+ development:
33
+ <<: *default
34
+ compile: true
35
+
36
+ # Reference: https://webpack.js.org/configuration/dev-server/
37
+ dev_server:
38
+ https: false
39
+ host: localhost
40
+ port: 3035
41
+ public: localhost:3035
42
+ hmr: false
43
+ # Inline should be set to true if using HMR
44
+ inline: true
45
+ overlay: true
46
+ disable_host_check: true
47
+ use_local_ip: false
48
+
49
+ test:
50
+ <<: *default
51
+ compile: true
52
+
53
+ # Compile test packs to a separate directory
54
+ public_output_path: packs-test
55
+
56
+ production:
57
+ <<: *default
58
+
59
+ # Production depends on precompilation of packs prior to booting for performance.
60
+ compile: false
61
+
62
+ # Cache manifest.json for performance
63
+ cache_manifest: true
64
+
65
+ staging:
66
+ <<: *default
67
+
68
+ # Production depends on precompilation of packs prior to booting for performance.
69
+ compile: false
70
+
71
+ # Cache manifest.json for performance
72
+ cache_manifest: true
73
+
74
+ # Compile staging packs to a separate directory
75
+ public_output_path: packs-staging
@@ -0,0 +1,5 @@
1
+ # This file allows the `Rails.root` to be correctly determined.
2
+
3
+ require_relative "config/environment"
4
+
5
+ run Rails.application
@@ -0,0 +1,7 @@
1
+ {
2
+ "private": true,
3
+ "dependencies": {
4
+ "@rails/webpacker": "file:../../../../"
5
+ },
6
+ "license": "MIT"
7
+ }
@@ -11,21 +11,12 @@ class RakeTasksTest < Minitest::Test
11
11
  assert_includes output, "webpacker:clobber"
12
12
  assert_includes output, "webpacker:compile"
13
13
  assert_includes output, "webpacker:install"
14
- assert_includes output, "webpacker:install:angular"
15
- assert_includes output, "webpacker:install:coffee"
16
- assert_includes output, "webpacker:install:elm"
17
- assert_includes output, "webpacker:install:erb"
18
- assert_includes output, "webpacker:install:react"
19
- assert_includes output, "webpacker:install:svelte"
20
- assert_includes output, "webpacker:install:stimulus"
21
- assert_includes output, "webpacker:install:typescript"
22
- assert_includes output, "webpacker:install:vue"
23
14
  assert_includes output, "webpacker:verify_install"
24
15
  end
25
16
 
26
17
  def test_rake_task_webpacker_check_binstubs
27
18
  output = Dir.chdir(test_app_path) { `rake webpacker:check_binstubs 2>&1` }
28
- refute_includes output, "webpack binstubs not found."
19
+ refute_includes output, "webpack binstub not found."
29
20
  end
30
21
 
31
22
  def test_check_node_version
@@ -1,7 +1,7 @@
1
1
  /* eslint no-console:0 */
2
2
  // This file is automatically compiled by Webpack, along with any other files
3
3
  // present in this directory. You're encouraged to place your actual application logic in
4
- // a relevant structure within app/javascript and only use these pack files to reference
4
+ // a relevant structure within app/packs and only use these pack files to reference
5
5
  // that code so it'll be compiled.
6
6
  //
7
7
  // To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
@@ -1,30 +1,24 @@
1
1
  # Note: You must restart bin/webpack-dev-server for changes to take effect
2
2
 
3
3
  default: &default
4
- source_path: app/javascript
5
- source_entry_path: packs
4
+ source_path: app/packs
5
+ source_entry_path: entrypoints
6
6
  public_root_path: public
7
7
  public_output_path: packs
8
- cache_path: tmp/cache/webpacker
8
+ cache_path: tmp/webpacker
9
9
  webpack_compile_output: false
10
10
 
11
- # Additional paths webpack should lookup modules
11
+ # Additional paths webpack should look up modules
12
12
  # ['app/assets', 'engine/foo/app/assets']
13
13
  additional_paths:
14
14
  - app/assets
15
15
  - /etc/yarn
16
-
17
- # This configuration option is deprecated and is only here for testing, to
18
- # ensure backwards-compatibility. Please use `additional_paths`.
19
- resolved_paths:
16
+ - some.config.js
20
17
  - app/elm
21
18
 
22
19
  # Reload manifest.json on all requests so we reload latest compiled packs
23
20
  cache_manifest: false
24
21
 
25
- # Extract and emit a css file
26
- extract_css: false
27
-
28
22
  static_assets_extensions:
29
23
  - .jpg
30
24
  - .jpeg
@@ -37,18 +31,6 @@ default: &default
37
31
  extensions:
38
32
  - .mjs
39
33
  - .js
40
- - .sass
41
- - .scss
42
- - .css
43
- - .module.sass
44
- - .module.scss
45
- - .module.css
46
- - .png
47
- - .svg
48
- - .gif
49
- - .jpeg
50
- - .jpg
51
- - .elm
52
34
 
53
35
  development:
54
36
  <<: *default
@@ -61,8 +43,6 @@ development:
61
43
  port: 3035
62
44
  public: localhost:3035
63
45
  hmr: false
64
- # Inline should be set to true if using HMR
65
- inline: true
66
46
  overlay: true
67
47
  disable_host_check: true
68
48
  use_local_ip: false
@@ -81,9 +61,6 @@ production:
81
61
  # Production depends on precompilation of packs prior to booting for performance.
82
62
  compile: false
83
63
 
84
- # Extract and emit a css file
85
- extract_css: true
86
-
87
64
  # Cache manifest.json for performance
88
65
  cache_manifest: true
89
66
 
@@ -93,9 +70,6 @@ staging:
93
70
  # Production depends on precompilation of packs prior to booting for performance.
94
71
  compile: false
95
72
 
96
- # Extract and emit a css file
97
- extract_css: true
98
-
99
73
  # Cache manifest.json for performance
100
74
  cache_manifest: true
101
75
 
@@ -0,0 +1,79 @@
1
+ # Note: You must restart bin/webpack-dev-server for changes to take effect
2
+
3
+ default: &default
4
+ source_path: app/packs
5
+ source_entry_path: entrypoints
6
+ public_root_path: public
7
+ public_output_path: packs
8
+ cache_path: tmp/cache/webpacker
9
+ webpack_compile_output: false
10
+
11
+ # Additional paths webpack should look up modules
12
+ # ['app/assets', 'engine/foo/app/assets']
13
+ additional_paths:
14
+ - app/assets
15
+ - /etc/yarn
16
+ - some.config.js
17
+ - app/elm
18
+
19
+ # Reload manifest.json on all requests so we reload latest compiled packs
20
+ cache_manifest: false
21
+
22
+ static_assets_extensions:
23
+ - .jpg
24
+ - .jpeg
25
+ - .png
26
+ - .gif
27
+ - .tiff
28
+ - .ico
29
+ - .svg
30
+
31
+ extensions:
32
+ - .mjs
33
+ - .js
34
+
35
+ development:
36
+ <<: *default
37
+ compile: true
38
+
39
+ # Reference: https://webpack.js.org/configuration/dev-server/
40
+ dev_server:
41
+ https: false
42
+ host: localhost
43
+ port: 3035
44
+ public: localhost:3035
45
+ hmr: false
46
+ # Inline should be set to true if using HMR
47
+ inline: true
48
+ overlay: true
49
+ disable_host_check: true
50
+ use_local_ip: false
51
+ pretty: false
52
+
53
+ test:
54
+ <<: *default
55
+ compile: true
56
+
57
+ # Compile test packs to a separate directory
58
+ public_output_path: packs-test
59
+
60
+ production:
61
+ <<: *default
62
+
63
+ # Production depends on precompilation of packs prior to booting for performance.
64
+ compile: false
65
+
66
+ # Cache manifest.json for performance
67
+ cache_manifest: true
68
+
69
+ staging:
70
+ <<: *default
71
+
72
+ # Production depends on precompilation of packs prior to booting for performance.
73
+ compile: false
74
+
75
+ # Cache manifest.json for performance
76
+ cache_manifest: true
77
+
78
+ # Compile staging packs to a separate directory
79
+ public_output_path: packs-staging
@@ -15,5 +15,4 @@ test:
15
15
  production:
16
16
  <<: *default
17
17
  compile: false
18
- extract_css: true
19
18
  cache_manifest: true
@@ -5,28 +5,46 @@
5
5
  "application.js": "/packs/application-k344a6d59eef8632c9d1.js",
6
6
  "application.png": "/packs/application-k344a6d59eef8632c9d1.png",
7
7
  "fonts/fa-regular-400.woff2": "/packs/fonts/fa-regular-400-944fb546bd7018b07190a32244f67dc9.woff2",
8
- "media/images/image.jpg": "/packs/media/images/image-c38deda30895059837cf.jpg",
9
- "media/images/image-2x.jpg": "/packs/media/images/image-2x-7cca48e6cae66ec07b8e.jpg",
10
- "media/images/nested/image.jpg": "/packs/media/images/nested/image-c38deda30895059837cf.jpg",
11
- "media/images/mb-icon.png": "/packs/media/images/mb-icon-c38deda30895059837cf.png",
12
- "media/images/nested/mb-icon.png": "/packs/media/images/nested/mb-icon-c38deda30895059837cf.png",
8
+ "static/image.jpg": "/packs/static/image-c38deda30895059837cf.jpg",
9
+ "static/image-2x.jpg": "/packs/static/image-2x-7cca48e6cae66ec07b8e.jpg",
10
+ "static/nested/image.jpg": "/packs/static/nested/image-c38deda30895059837cf.jpg",
11
+ "static/mb-icon.png": "/packs/static/mb-icon-c38deda30895059837cf.png",
12
+ "static/nested/mb-icon.png": "/packs/static/nested/mb-icon-c38deda30895059837cf.png",
13
13
  "entrypoints": {
14
14
  "application": {
15
- "js": [
16
- "/packs/vendors~application~bootstrap-c20632e7baf2c81200d3.chunk.js",
17
- "/packs/vendors~application-e55f2aae30c07fb6d82a.chunk.js",
18
- "/packs/application-k344a6d59eef8632c9d1.js"
19
- ],
20
- "css": [
21
- "/packs/1-c20632e7baf2c81200d3.chunk.css",
22
- "/packs/application-k344a6d59eef8632c9d1.chunk.css"
23
- ]
15
+ "assets": {
16
+ "js": [
17
+ "/packs/vendors~application~bootstrap-c20632e7baf2c81200d3.chunk.js",
18
+ "/packs/vendors~application-e55f2aae30c07fb6d82a.chunk.js",
19
+ "/packs/application-k344a6d59eef8632c9d1.js"
20
+ ],
21
+ "css": [
22
+ "/packs/1-c20632e7baf2c81200d3.chunk.css",
23
+ "/packs/application-k344a6d59eef8632c9d1.chunk.css"
24
+ ]
25
+ }
26
+ },
27
+ "bootstrap": {
28
+ "assets": {
29
+ "js": [
30
+ "/packs/bootstrap-300631c4f0e0f9c865bc.js"
31
+ ]
32
+ }
24
33
  },
25
34
  "hello_stimulus": {
26
- "css": [
27
- "/packs/1-c20632e7baf2c81200d3.chunk.css",
28
- "/packs/hello_stimulus-k344a6d59eef8632c9d1.chunk.css"
29
- ]
35
+ "assets": {
36
+ "css": [
37
+ "/packs/1-c20632e7baf2c81200d3.chunk.css",
38
+ "/packs/hello_stimulus-k344a6d59eef8632c9d1.chunk.css"
39
+ ]
40
+ }
41
+ },
42
+ "print/application": {
43
+ "assets": {
44
+ "css": [
45
+ "/packs/print/application-983b6c164a47f7ed49cd.css"
46
+ ]
47
+ }
30
48
  }
31
49
  }
32
50
  }
File without changes
@@ -24,23 +24,29 @@ class WebpackRunnerTest < Webpacker::Test
24
24
  verify_command(cmd, use_node_modules: false)
25
25
  end
26
26
 
27
+ def test_run_cmd_argv
28
+ cmd = ["#{test_app_path}/node_modules/.bin/webpack", "--config", "#{test_app_path}/config/webpack/development.js", "--watch"]
29
+
30
+ verify_command(cmd, argv: ["--watch"])
31
+ end
32
+
27
33
  private
28
34
  def test_app_path
29
35
  File.expand_path("test_app", __dir__)
30
36
  end
31
37
 
32
- def verify_command(cmd, use_node_modules: true)
38
+ def verify_command(cmd, use_node_modules: true, argv: [])
33
39
  cwd = Dir.pwd
34
40
  Dir.chdir(test_app_path)
35
41
 
36
42
  klass = Webpacker::WebpackRunner
37
- instance = klass.new([])
43
+ instance = klass.new(argv)
38
44
  mock = Minitest::Mock.new
39
45
  mock.expect(:call, nil, [Webpacker::Compiler.env, *cmd])
40
46
 
41
47
  klass.stub(:new, instance) do
42
48
  instance.stub(:node_modules_bin_exist?, use_node_modules) do
43
- Kernel.stub(:exec, mock) { klass.run([]) }
49
+ Kernel.stub(:exec, mock) { klass.run(argv) }
44
50
  end
45
51
  end
46
52