shakapacker 6.6.0 → 7.0.0.rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-backward-compatibility.yml +43 -0
  3. data/CHANGELOG.md +50 -4
  4. data/CONTRIBUTING.md +4 -4
  5. data/Gemfile.development_dependencies +1 -1
  6. data/README.md +113 -88
  7. data/Rakefile +5 -0
  8. data/config/shakapacker.yml +1 -0
  9. data/docs/deployment.md +12 -10
  10. data/docs/developing_webpacker.md +5 -5
  11. data/docs/react.md +10 -6
  12. data/docs/style_loader_vs_mini_css.md +2 -2
  13. data/docs/troubleshooting.md +22 -18
  14. data/docs/using_esbuild_loader.md +5 -3
  15. data/docs/using_swc_loader.md +2 -2
  16. data/docs/v6_upgrade.md +2 -2
  17. data/docs/v7_upgrade.md +56 -0
  18. data/lib/install/bin/shakapacker +13 -0
  19. data/lib/install/bin/shakapacker-dev-server +13 -0
  20. data/lib/install/config/{webpacker.yml → shakapacker.yml} +13 -8
  21. data/lib/install/template.rb +7 -7
  22. data/lib/{webpacker → shakapacker}/base_strategy.rb +2 -2
  23. data/lib/{webpacker → shakapacker}/commands.rb +4 -4
  24. data/lib/{webpacker → shakapacker}/compiler.rb +43 -15
  25. data/lib/{webpacker → shakapacker}/compiler_strategy.rb +6 -6
  26. data/lib/{webpacker → shakapacker}/configuration.rb +52 -21
  27. data/lib/shakapacker/deprecation_helper.rb +88 -0
  28. data/lib/{webpacker → shakapacker}/dev_server.rb +27 -4
  29. data/lib/{webpacker → shakapacker}/dev_server_proxy.rb +4 -4
  30. data/lib/shakapacker/dev_server_runner.rb +104 -0
  31. data/lib/{webpacker → shakapacker}/digest_strategy.rb +6 -6
  32. data/lib/{webpacker → shakapacker}/env.rb +8 -8
  33. data/lib/{webpacker → shakapacker}/helper.rb +20 -20
  34. data/lib/{webpacker → shakapacker}/instance.rb +13 -10
  35. data/lib/{webpacker → shakapacker}/manifest.rb +14 -14
  36. data/lib/{webpacker → shakapacker}/mtime_strategy.rb +5 -5
  37. data/lib/shakapacker/railtie.rb +70 -0
  38. data/lib/shakapacker/runner.rb +28 -0
  39. data/lib/shakapacker/utils/version_syntax_converter.rb +2 -2
  40. data/lib/{webpacker → shakapacker}/version.rb +2 -2
  41. data/lib/{webpacker → shakapacker}/version_checker.rb +8 -8
  42. data/lib/shakapacker/webpack_runner.rb +67 -0
  43. data/lib/shakapacker.rb +51 -1
  44. data/lib/tasks/shakapacker/binstubs.rake +15 -0
  45. data/lib/tasks/shakapacker/check_binstubs.rake +25 -0
  46. data/lib/tasks/shakapacker/check_node.rake +31 -0
  47. data/lib/tasks/shakapacker/check_yarn.rake +33 -0
  48. data/lib/tasks/shakapacker/clean.rake +23 -0
  49. data/lib/tasks/shakapacker/clobber.rake +18 -0
  50. data/lib/tasks/shakapacker/compile.rake +31 -0
  51. data/lib/tasks/shakapacker/info.rake +21 -0
  52. data/lib/tasks/shakapacker/install.rake +17 -0
  53. data/lib/tasks/shakapacker/verify_config.rake +12 -0
  54. data/lib/tasks/shakapacker/verify_install.rake +4 -0
  55. data/lib/tasks/shakapacker/yarn_install.rake +24 -0
  56. data/lib/tasks/shakapacker.rake +18 -0
  57. data/lib/tasks/webpacker/binstubs.rake +5 -11
  58. data/lib/tasks/webpacker/check_binstubs.rake +6 -9
  59. data/lib/tasks/webpacker/check_node.rake +5 -27
  60. data/lib/tasks/webpacker/check_yarn.rake +5 -29
  61. data/lib/tasks/webpacker/clean.rake +5 -19
  62. data/lib/tasks/webpacker/clobber.rake +6 -13
  63. data/lib/tasks/webpacker/compile.rake +5 -33
  64. data/lib/tasks/webpacker/info.rake +5 -17
  65. data/lib/tasks/webpacker/install.rake +5 -13
  66. data/lib/tasks/webpacker/verify_config.rake +6 -11
  67. data/lib/tasks/webpacker/verify_install.rake +7 -2
  68. data/lib/tasks/webpacker/yarn_install.rake +5 -20
  69. data/lib/tasks/webpacker.rake +15 -13
  70. data/lib/webpacker/dev_server_runner.rb +9 -96
  71. data/lib/webpacker/webpack_runner.rb +9 -58
  72. data/lib/webpacker.rb +3 -47
  73. data/package/__tests__/config-bc.js +27 -0
  74. data/package/__tests__/config.js +6 -5
  75. data/package/__tests__/dev_server-bc.js +46 -0
  76. data/package/__tests__/dev_server.js +9 -8
  77. data/package/__tests__/development-bc.js +66 -0
  78. data/package/__tests__/development.js +36 -5
  79. data/package/__tests__/env-bc.js +59 -0
  80. data/package/__tests__/env.js +3 -2
  81. data/package/__tests__/index.js +13 -0
  82. data/package/__tests__/production-bc.js +51 -0
  83. data/package/__tests__/production.js +25 -3
  84. data/package/__tests__/staging-bc.js +53 -0
  85. data/package/__tests__/staging.js +27 -4
  86. data/package/__tests__/test-bc.js +43 -0
  87. data/package/__tests__/test.js +22 -4
  88. data/package/babel/preset.js +1 -4
  89. data/package/config.js +25 -7
  90. data/package/dev_server.js +7 -4
  91. data/package/env.js +22 -3
  92. data/package/environments/__tests__/base-bc.js +107 -0
  93. data/package/environments/__tests__/base.js +13 -13
  94. data/package/environments/base.js +1 -1
  95. data/package/environments/development.js +4 -46
  96. data/package/environments/production.js +1 -1
  97. data/package/index.js +11 -4
  98. data/package/rules/__tests__/__utils__/webpack.js +1 -1
  99. data/package/rules/__tests__/file.js +27 -0
  100. data/package/rules/__tests__/swc.js +1 -2
  101. data/package/rules/file.js +2 -2
  102. data/package/utils/configPath.js +19 -0
  103. data/package/utils/defaultConfigPath.js +2 -0
  104. data/package/utils/get_style_rule.js +5 -2
  105. data/package/utils/helpers.js +24 -1
  106. data/package/utils/inliningCss.js +7 -0
  107. data/package/utils/snakeToCamelCase +7 -0
  108. data/package/webpackDevServerConfig.js +68 -0
  109. data/package.json +2 -2
  110. data/{webpacker.gemspec → shakapacker.gemspec} +3 -3
  111. data/spec/backward_compatibility_specs/command_spec_bc.rb +116 -0
  112. data/spec/backward_compatibility_specs/compiler_spec_bc.rb +59 -0
  113. data/spec/backward_compatibility_specs/compiler_strategy_spec_bc.rb +22 -0
  114. data/spec/backward_compatibility_specs/configuration_spec_bc.rb +286 -0
  115. data/spec/backward_compatibility_specs/dev_server_runner_spec_bc.rb +79 -0
  116. data/spec/backward_compatibility_specs/dev_server_spec_bc.rb +47 -0
  117. data/spec/backward_compatibility_specs/digest_strategy_spec_bc.rb +35 -0
  118. data/spec/backward_compatibility_specs/engine_rake_tasks_spec_bc.rb +44 -0
  119. data/spec/backward_compatibility_specs/env_spec_bc.rb +23 -0
  120. data/spec/backward_compatibility_specs/helper_spec_bc.rb +243 -0
  121. data/spec/backward_compatibility_specs/instance_spec_bc.rb +31 -0
  122. data/spec/backward_compatibility_specs/manifest_spec_bc.rb +100 -0
  123. data/spec/backward_compatibility_specs/mtime_strategy_spec_bc.rb +55 -0
  124. data/spec/backward_compatibility_specs/rake_tasks_spec_bc.rb +37 -0
  125. data/spec/backward_compatibility_specs/spec_helper_initializer.rb +24 -0
  126. data/spec/backward_compatibility_specs/webpack_runner_spec_bc.rb +56 -0
  127. data/spec/backward_compatibility_specs/webpacker_spec_bc.rb +41 -0
  128. data/spec/backward_compatibility_specs/webpacker_test_app/.gitignore +2 -0
  129. data/spec/backward_compatibility_specs/webpacker_test_app/Rakefile +3 -0
  130. data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/app/packs/entrypoints/application.js +1 -1
  131. data/{lib/install → spec/backward_compatibility_specs/webpacker_test_app}/bin/webpacker +0 -0
  132. data/spec/backward_compatibility_specs/webpacker_test_app/config/application.rb +11 -0
  133. data/spec/backward_compatibility_specs/webpacker_test_app/config/environment.rb +4 -0
  134. data/spec/backward_compatibility_specs/webpacker_test_app/config/initializers/inspect_autoload_paths.rb +1 -0
  135. data/spec/backward_compatibility_specs/webpacker_test_app/config/webpack/webpack.config.js +0 -0
  136. data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/config/webpacker.yml +1 -1
  137. data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/config/webpacker_css_extract_ignore_order_warnings.yml +1 -1
  138. data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/config/webpacker_defaults_fallback.yml +1 -1
  139. data/spec/backward_compatibility_specs/webpacker_test_app/config/webpacker_no_precompile.yml +7 -0
  140. data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/config/webpacker_other_location.yml +1 -1
  141. data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/config/webpacker_public_root.yml +1 -1
  142. data/spec/backward_compatibility_specs/webpacker_test_app/config.ru +5 -0
  143. data/spec/backward_compatibility_specs/webpacker_test_app/package.json +13 -0
  144. data/spec/backward_compatibility_specs/webpacker_test_app/public/packs/manifest.json +58 -0
  145. data/spec/backward_compatibility_specs/webpacker_test_app/some.config.js +0 -0
  146. data/spec/backward_compatibility_specs/webpacker_test_app/tmp/shakapacker/last-compilation-digest-production +1 -0
  147. data/spec/backward_compatibility_specs/webpacker_test_app/yarn.lock +11 -0
  148. data/spec/command_spec.rb +18 -16
  149. data/spec/compiler_spec.rb +19 -17
  150. data/spec/compiler_strategy_spec.rb +9 -7
  151. data/spec/configuration_spec.rb +108 -66
  152. data/spec/dev_server_runner_spec.rb +9 -8
  153. data/spec/dev_server_spec.rb +97 -9
  154. data/spec/digest_strategy_spec.rb +4 -2
  155. data/spec/engine_rake_tasks_spec.rb +12 -16
  156. data/spec/env_spec.rb +7 -5
  157. data/spec/helper_spec.rb +4 -2
  158. data/spec/instance_spec.rb +31 -0
  159. data/spec/manifest_spec.rb +21 -19
  160. data/spec/mounted_app/test/dummy/config/application.rb +1 -1
  161. data/spec/mounted_app/test/dummy/config/webpacker.yml +3 -3
  162. data/spec/mtime_strategy_spec.rb +4 -2
  163. data/spec/rake_tasks_spec.rb +20 -18
  164. data/spec/spec_helper.rb +0 -25
  165. data/spec/spec_helper_initializer.rb +24 -0
  166. data/spec/test_app/.gitignore +2 -0
  167. data/spec/test_app/app/javascript/entrypoints/application.js +10 -0
  168. data/spec/test_app/app/javascript/entrypoints/generated/something.js +2 -0
  169. data/spec/test_app/app/javascript/entrypoints/multi_entry.css +4 -0
  170. data/spec/test_app/app/javascript/entrypoints/multi_entry.js +4 -0
  171. data/spec/test_app/bin/{webpacker-dev-server → shakapacker} +3 -3
  172. data/spec/test_app/bin/{webpacker → shakapacker-dev-server} +3 -3
  173. data/spec/test_app/config/application.rb +1 -1
  174. data/spec/test_app/config/shakapacker.yml +82 -0
  175. data/spec/test_app/config/shakapacker_css_extract_ignore_order_warnings.yml +84 -0
  176. data/spec/test_app/config/shakapacker_defaults_fallback.yml +11 -0
  177. data/spec/test_app/config/shakapacker_manifest_path.yml +80 -0
  178. data/spec/test_app/config/shakapacker_nested_entries.yml +83 -0
  179. data/spec/test_app/config/shakapacker_no_precompile.yml +7 -0
  180. data/spec/test_app/config/shakapacker_other_location.yml +85 -0
  181. data/spec/test_app/config/shakapacker_public_root.yml +18 -0
  182. data/spec/version_checker_spec.rb +16 -15
  183. data/spec/webpack_runner_spec.rb +4 -3
  184. data/spec/webpacker_spec.rb +9 -29
  185. metadata +119 -44
  186. data/config/webpacker.yml +0 -1
  187. data/lib/webpacker/railtie.rb +0 -70
  188. data/lib/webpacker/runner.rb +0 -23
  189. data/package/configPath.js +0 -3
  190. data/package/inliningCss.js +0 -7
  191. data/spec/test_app/config/webpacker_no_precompile.yml +0 -7
  192. /data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/app/packs/entrypoints/generated/something.js +0 -0
  193. /data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/app/packs/entrypoints/multi_entry.css +0 -0
  194. /data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/app/packs/entrypoints/multi_entry.js +0 -0
  195. /data/{lib/install → spec/backward_compatibility_specs/webpacker_test_app}/bin/webpacker-dev-server +0 -0
  196. /data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/config/webpacker_manifest_path.yml +0 -0
  197. /data/spec/{test_app → backward_compatibility_specs/webpacker_test_app}/config/webpacker_nested_entries.yml +0 -0
@@ -1,4 +1,4 @@
1
- # Developing Webpacker
1
+ # Developing Shakapacker
2
2
 
3
3
  It's a little trickier for Rails developers to work on the JS code of a project like shakacode/shakapacker. So here are some tips!
4
4
 
@@ -7,16 +7,16 @@ For example, for React on Rails Changes, I'm using [shakacode/react_on_rails_tut
7
7
  This directory is the `TEST_APP_DIR`.
8
8
 
9
9
  ## Fork shakacode/shakapacker
10
- Let's call the shakacode/shakapacker directory `WEBPACKER_DIR` which has shakacode/shakapacker's `package.json`.
10
+ Let's call the shakacode/shakapacker directory `SHAKAPACKER_DIR` which has shakacode/shakapacker's `package.json`.
11
11
 
12
12
  ## Changing the Package
13
13
  ### Setup with Yalc
14
14
  Use [`yalc`](https://github.com/wclr/yalc) unless you like yak shaving weird errors.
15
- 1. In `WEBPACKER_DIR`, run `yalc publish`
15
+ 1. In `SHAKAPACKER_DIR`, run `yalc publish`
16
16
  2. In `TEST_APP_DIR`, run `yalc link shakapacker`
17
17
 
18
18
  ## Update the Package Code
19
- 1. Make some JS change in WEBPACKER_DIR
19
+ 1. Make some JS change in SHAKAPACKER_DIR
20
20
  2. Run `yalc push` and your changes will be pushed to your `TEST_APP_DIR`'s node_modules.
21
21
  3. You may need to run `yarn` in `TEST_APP_DIR` if you added or removed dependencies of shakacode/shakapacker.
22
22
 
@@ -25,5 +25,5 @@ Use [`yalc`](https://github.com/wclr/yalc) unless you like yak shaving weird err
25
25
  For the Ruby part, just change the gem reference `TEST_APP_DIR`, like:
26
26
 
27
27
  ```ruby
28
- gem "webpacker", path: "../../forks/webpacker"
28
+ gem "shakapacker", path: "../../forks/shakapacker"
29
29
  ```
data/docs/react.md CHANGED
@@ -47,7 +47,7 @@ With HMR enabled, Shakapacker will automatically update only that part of the pa
47
47
 
48
48
  To enable HMR in a React app, proceed as follows:.
49
49
 
50
- In `config/webpacker.yml` set `hmr` is set to `true`.
50
+ In `config/shakapacker.yml` set `hmr` is set to `true`.
51
51
 
52
52
  Install the [react-refresh](https://www.npmjs.com/package/react-refresh) package, as well as [@pmmmwh/react-refresh-webpack-plugin](https://www.npmjs.com/package/@pmmmwh/react-refresh-webpack-plugin):
53
53
 
@@ -58,10 +58,12 @@ yarn add --dev react-refresh @pmmmwh/react-refresh-webpack-plugin
58
58
  Alter `config/webpack/webpack.config.js` like so:
59
59
 
60
60
  ```js
61
- const { webpackConfig, inliningCss } = require('shakapacker');
61
+ const { generateWebpackConfig, inliningCss } = require('shakapacker');
62
62
  const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
63
63
  const isDevelopment = process.env.NODE_ENV !== 'production';
64
64
 
65
+ const webpackConfig = generateWebpackConfig();
66
+
65
67
  if (isDevelopment && inliningCss) {
66
68
  webpackConfig.plugins.push(
67
69
  new ReactRefreshWebpackPlugin({
@@ -139,7 +141,7 @@ rails new myapp --skip-javascript
139
141
  cd myapp
140
142
  bundle add shakapacker --strict
141
143
  ./bin/bundle install
142
- ./bin/rails webpacker:install
144
+ ./bin/rails shakapacker:install
143
145
  yarn add react react-dom @babel/preset-react
144
146
  yarn add css-loader style-loader mini-css-extract-plugin css-minimizer-webpack-plugin
145
147
  ```
@@ -182,7 +184,7 @@ export default HelloMessage;
182
184
  h1 { color: blue; }
183
185
  ```
184
186
 
185
- 7. Enable HMR in config/webpacker.yml:
187
+ 7. Enable HMR in config/shakapacker.yml:
186
188
  ```shell
187
189
  hmr: true
188
190
  ```
@@ -196,10 +198,12 @@ yarn add --dev react-refresh @pmmmwh/react-refresh-webpack-plugin
196
198
  9. Alter `config/webpack/webpack.config.js` like so:
197
199
 
198
200
  ```js
199
- const { webpackConfig, inliningCss } = require('shakapacker');
201
+ const { generateWebpackConfig, inliningCss } = require('shakapacker');
200
202
  const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
201
203
  const isDevelopment = process.env.NODE_ENV !== 'production';
202
204
 
205
+ const webpackConfig = generateWebpackConfig();
206
+
203
207
  if (isDevelopment && inliningCss) {
204
208
  webpackConfig.plugins.push(
205
209
  new ReactRefreshWebpackPlugin({
@@ -261,7 +265,7 @@ module.exports = function (api) {
261
265
  9. Start the Rails server and the webpack-dev-server in separate console windows:
262
266
  ```shell
263
267
  rails s
264
- ./bin/webpacker-dev-server
268
+ ./bin/shakapacker-dev-server
265
269
  ```
266
270
 
267
271
  10. Hit: <http://localhost:3000/site/index>
@@ -2,10 +2,10 @@
2
2
 
3
3
  You have two options for serving CSS in development:
4
4
 
5
- 1. You can opt to serve CSS via style-loader (as was traditionally done in a Webpack setup), where CSS is written by Javascript served by Webpacker into a `<style>` tag, or
5
+ 1. You can opt to serve CSS via style-loader (as was traditionally done in a Webpack setup), where CSS is written by Javascript served by Shakapacker into a `<style>` tag, or
6
6
  2. You can opt to serve CSS as a full CSS file via mini-css-extract-plugin, which uses a standard `<link>` tag to load a fully separate CSS file.
7
7
 
8
- Both options support HMR. The default is style-loader. If you want to use mini-css-extract-plugin in development, set `inline_css: false` in the development dev_server section of your webpacker.yml:
8
+ Both options support HMR. The default is style-loader. If you want to use mini-css-extract-plugin in development, set `inline_css: false` in the development dev_server section of your shakapacker.yml:
9
9
 
10
10
  ```yml
11
11
  development:
@@ -5,7 +5,7 @@
5
5
  1. Read the error message carefully. The error message will tell you the precise key value
6
6
  that is not matching what Webpack expects.
7
7
 
8
- 2. Put a `debugger` statement in your Webpack configuration and run `bin/webpacker --debug-webpacker`.
8
+ 2. Put a `debugger` statement in your Webpack configuration and run `bin/shakapacker --debug-shakapacker`.
9
9
  If you have a node debugger installed, you'll see the Chrome debugger for your webpack
10
10
  config. For example, install the Chrome extension
11
11
  [NiM](https://chrome.google.com/webstore/detail/nodejs-v8-inspector-manag/gnhhdgbaldcilmgcpfddgdbkhjohddkj) and
@@ -13,9 +13,9 @@
13
13
  For more details on debugging, see the official
14
14
  [Webpack docs on debugging](https://webpack.js.org/contribute/debugging/#devtools)
15
15
 
16
- 3. Any arguments that you add to bin/webpacker get sent to webpack. For example, you can pass `--debug` to switch loaders to debug mode. See [webpack CLI debug options](https://webpack.js.org/api/cli/#debug-options) for more information on the available options.
16
+ 3. Any arguments that you add to bin/shakapacker get sent to webpack. For example, you can pass `--debug` to switch loaders to debug mode. See [webpack CLI debug options](https://webpack.js.org/api/cli/#debug-options) for more information on the available options.
17
17
 
18
- 4. You can also pass additional options to the command to run the webpack-dev-server and start the webpack-dev-server with the option `--debug-webpacker`
18
+ 4. You can also pass additional options to the command to run the webpack-dev-server and start the webpack-dev-server with the option `--debug-shakapacker`
19
19
 
20
20
  ## Incorrect peer dependencies
21
21
  The latest version of Shakapacker uses peer dependencies to make upgrading easier. However, there's a catch.
@@ -38,12 +38,12 @@ So, be sure to investigate warnings from `yarn install`!
38
38
  ## ENOENT: no such file or directory - node-sass
39
39
 
40
40
  If you get the error `ENOENT: no such file or directory - node-sass` on deploy with
41
- `assets:precompile` or `bundle exec rails webpacker:compile` you may need to
41
+ `assets:precompile` or `bundle exec rails shakapacker:compile` you may need to
42
42
  move Sass to production `dependencies`.
43
43
 
44
44
  Move any packages that related to Sass (e.g. `node-sass` or `sass-loader`) from
45
45
  `devDependencies` to `dependencies` in `package.json`. This is because
46
- webpacker is running on a production system with the Rails workflow to build
46
+ shakapacker is running on a production system with the Rails workflow to build
47
47
  the assets. Particularly on hosting providers that try to detect and do the right
48
48
  thing, like Heroku.
49
49
 
@@ -64,11 +64,11 @@ In `package.json`:
64
64
 
65
65
  * If you get this error `Can't find hello_react.js in manifest.json`
66
66
  when loading a view in the browser it's because webpack is still compiling packs.
67
- Webpacker uses a `manifest.json` file to keep track of packs in all environments,
67
+ Shakapacker uses a `manifest.json` file to keep track of packs in all environments,
68
68
  however since this file is generated after packs are compiled by webpack. So,
69
69
  if you load a view in browser whilst webpack is compiling you will get this error.
70
70
  Therefore, make sure webpack
71
- (i.e `./bin/webpacker-dev-server`) is running and has
71
+ (i.e `./bin/shakapacker-dev-server`) is running and has
72
72
  completed the compilation successfully before loading a view.
73
73
 
74
74
 
@@ -85,7 +85,7 @@ completed the compilation successfully before loading a view.
85
85
 
86
86
  ## webpack or webpack-dev-server not found
87
87
 
88
- * This could happen if `webpacker:install` step is skipped. Please run `bundle exec rails webpacker:install` to fix the issue.
88
+ * This could happen if `shakapacker:install` step is skipped. Please run `bundle exec rails shakapacker:install` to fix the issue.
89
89
 
90
90
  * If you encounter the above error on heroku after upgrading from Rails 4.x to 5.1.x, then the problem might be related to missing `yarn` binstub. Please run following commands to update/add binstubs:
91
91
 
@@ -97,7 +97,7 @@ bundle config --delete bin
97
97
  ## Running webpack on Windows
98
98
 
99
99
  If you are running webpack on Windows, your command shell may not be able to interpret the preferred interpreter
100
- for the scripts generated in `bin/webpacker` and `bin/webpacker-dev-server`. Instead you'll want to run the scripts
100
+ for the scripts generated in `bin/shakapacker` and `bin/shakapacker-dev-server`. Instead you'll want to run the scripts
101
101
  manually with Ruby:
102
102
 
103
103
  ```
@@ -107,7 +107,7 @@ C:\path>ruby bin\webpack-dev-server
107
107
 
108
108
  ## Invalid configuration object. webpack has been initialised using a configuration object that does not match the API schema.
109
109
 
110
- If you receive this error when running `$ ./bin/webpacker-dev-server` ensure your configuration is correct; most likely the path to your "packs" folder is incorrect if you modified from the original "source_path" defined in `config/webpacker.yml`.
110
+ If you receive this error when running `$ ./bin/shakapacker-dev-server` ensure your configuration is correct; most likely the path to your "packs" folder is incorrect if you modified from the original "source_path" defined in `config/shakapacker.yml`.
111
111
 
112
112
  ## Running Elm on Continuous Integration (CI) services such as CircleCI, CodeShip, Travis CI
113
113
 
@@ -132,7 +132,7 @@ chmod +x $HOME/your_rails_app/node_modules/.bin/elm-make
132
132
  ```
133
133
 
134
134
  ## Rake assets:precompile fails. ExecJS::RuntimeError
135
- This error occurs because you are trying to minify by `terser` a pack that's already been minified by Webpacker. To avoid this conflict and prevent appearing of `ExecJS::RuntimeError` error, you will need to disable uglifier from Rails config:
135
+ This error occurs because you are trying to minify by `terser` a pack that's already been minified by Shakapacker. To avoid this conflict and prevent appearing of `ExecJS::RuntimeError` error, you will need to disable uglifier from Rails config:
136
136
 
137
137
  ```ruby
138
138
  # In production.rb
@@ -150,7 +150,9 @@ To silent these warnings, please update `config/webpack/webpack.config.js`:
150
150
  ```js
151
151
  const webpack = require('webpack')
152
152
  const { resolve } = require('path')
153
- const { webpackConfig, merge } = require('shakapacker')
153
+ const { generateWebpackConfig, merge } = require('shakapacker')
154
+
155
+ const webpackConfig = generateWebpackConfig();
154
156
 
155
157
  module.exports = merge(webpackConfig, {
156
158
  plugins: [
@@ -164,10 +166,10 @@ module.exports = merge(webpackConfig, {
164
166
 
165
167
  ### Compilation Fails Silently
166
168
 
167
- If compiling is not producing output files and there are no error messages to help troubleshoot. Setting the `webpack_compile_output` configuration variable to `true` in webpacker.yml may add some helpful error information to your log file (Rails `log/development.log` or `log/production.log`)
169
+ If compiling is not producing output files and there are no error messages to help troubleshoot. Setting the `webpack_compile_output` configuration variable to `true` in shakapacker.yml may add some helpful error information to your log file (Rails `log/development.log` or `log/production.log`)
168
170
 
169
171
  ```yml
170
- # webpacker.yml
172
+ # shakapacker.yml
171
173
  default: &default
172
174
  source_path: app/javascript
173
175
  source_entry_path: packs
@@ -188,7 +190,7 @@ Thus ProvidePlugin manages build-time dependencies to global symbols whereas the
188
190
 
189
191
  For instance, with [jQuery](https://jquery.com/):
190
192
  ```diff
191
- // app/packs/entrypoints/application.js
193
+ // app/javascript/entrypoints/application.js
192
194
 
193
195
  - import jQuery from 'jquery'
194
196
  - window.jQuery = jQuery
@@ -199,7 +201,9 @@ Instead do:
199
201
  // config/webpack/webpack.config.js
200
202
 
201
203
  const webpack = require('webpack')
202
- const { webpackConfig, merge } = require('shakapacker')
204
+ const { generateWebpackConfig, merge } = require('shakapacker')
205
+
206
+ const webpackConfig = generateWebpackConfig();
203
207
 
204
208
  module.exports = merge(webpackConfig, {
205
209
  plugins: [
@@ -218,11 +222,11 @@ using Heroku's Pipeline promote feature). You might find that your production
218
222
  application is using your staging `config.asset_host` host when using
219
223
  `javascript_pack_tag`.
220
224
 
221
- This can be fixed by setting the environment variable `WEBPACKER_ASSET_HOST` to
225
+ This can be fixed by setting the environment variable `SHAKAPACKER_ASSET_HOST` to
222
226
  an empty string where your assets are compiled. On Heroku this is done under
223
227
  *Settings* -> *Config Vars*.
224
228
 
225
- This way webpacker won't hard-code the CDN host into the manifest file used by
229
+ This way shakapacker won't hard-code the CDN host into the manifest file used by
226
230
  `javascript_pack_tag`, but instead fetch the CDN host at runtime, resolving the
227
231
  issue.
228
232
 
@@ -27,7 +27,7 @@ To use esbuild as your transpiler today. You need to do two things:
27
27
  yarn add esbuild esbuild-loader
28
28
  ```
29
29
 
30
- 2. Add or change `webpacker_loader` value in your default `webpacker.yml` config to `esbuild`
30
+ 2. Add or change `shakapacker_loader` value in your default `shakapacker.yml` config to `esbuild`
31
31
  The default configuration of babel is done by using `package.json` to use the file within the `shakapacker` package.
32
32
 
33
33
  ```yml
@@ -36,7 +36,7 @@ default: &default
36
36
  source_entry_path: /
37
37
  public_root_path: public
38
38
  public_output_path: packs
39
- cache_path: tmp/webpacker
39
+ cache_path: tmp/shakapacker
40
40
  webpack_compile_output: true
41
41
 
42
42
  # Additional paths webpack should look up modules
@@ -59,9 +59,11 @@ o do so, you need to modify your webpack configuration and use `ESBuildMinifyPlu
59
59
  Example:
60
60
 
61
61
  ```js
62
- const { webpackConfig: baseWebpackConfig, merge } = require('shakapacker')
62
+ const { generateWebpackConfig, merge } = require('shakapacker')
63
63
  const { ESBuildMinifyPlugin } = require('esbuild-loader')
64
64
 
65
+ const baseWebpackConfig = generateWebpackConfig()
66
+
65
67
  const options = {
66
68
  optimization: {
67
69
  minimizer: [
@@ -22,7 +22,7 @@ In order to use SWC as your compiler today. You need to do two things:
22
22
  yarn add @swc/core swc-loader
23
23
  ```
24
24
 
25
- 2. Add or change `webpack_loader` value in your default `webpacker.yml` config to `swc`
25
+ 2. Add or change `webpack_loader` value in your default `shakapacker.yml` config to `swc`
26
26
  The default configuration of babel is done by using `package.json` to use the file within the `shakapacker` package.
27
27
 
28
28
  ```yml
@@ -31,7 +31,7 @@ default: &default
31
31
  source_entry_path: /
32
32
  public_root_path: public
33
33
  public_output_path: packs
34
- cache_path: tmp/webpacker
34
+ cache_path: tmp/shakapacker
35
35
  webpack_compile_output: true
36
36
 
37
37
  # Additional paths webpack should look up modules
data/docs/v6_upgrade.md CHANGED
@@ -25,8 +25,7 @@ _If you're on webpacker v5, follow [how to upgrade to webpacker v6.0.0.rc.6 from
25
25
  1. Install the peer dependencies. Run `yarn add @babel/core @babel/plugin-transform-runtime @babel/preset-env @babel/runtime babel-loader compression-webpack-plugin terser-webpack-plugin webpack webpack-assets-manifest webpack-cli webpack-merge webpack-sources webpack-dev-server`. You may have old versions of libraries. Run `yarn install` and check for warnings like `warning " > shakapacker@6.1.1" has incorrect peer dependency "compression-webpack-plugin@^9.0.0"` and `file-loader@1.1.11" has incorrect peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0"`. In other words, warnings like these are **serious** and will cause considerable confusion if not respected.
26
26
  1. Update any scripts that called `bin/webpack` or `bin/webpack-dev-server` to `bin/webpacker` or `bin/webpacker-dev-server`
27
27
  1. Update your webpack config for a single config file, `config/webpack/webpack.config.js`. If you want to use the prior style of having a separate file for each NODE_ENV, you can use this shim for `config/webpack/webpack.config.js`. WARNING, previously, if you did not set `NODE_ENV`, `NODE_ENV` defaulted to `development`. Thus, you might expect `config/webpack/development.js` to run, but you'll instead be using the the configuration file that corresponds to your `RAILS_ENV`. If your `RAILS_ENV` is `test`, you'd be running `config/webpack/test.js`.
28
-
29
- ```js
28
+ ```js
30
29
  // name this file config/webpack/webpack.config.js
31
30
  const { env, webpackConfig } = require('shakapacker')
32
31
  const { existsSync } = require('fs')
@@ -46,6 +45,7 @@ _If you're on webpacker v5, follow [how to upgrade to webpacker v6.0.0.rc.6 from
46
45
  module.exports = envSpecificConfig()
47
46
  ```
48
47
  1. Update `babel.config.js` if you need JSX support. See [Customizing Babel Config](./customizing_babel_config.md)
48
+ 1. If you are using the view helper called `asset_pack_path`, change "media/" in path to "static/" or consider using the `image_pack_path`.
49
49
 
50
50
  ## How to upgrade to Webpacker v6.0.0.rc.6 from v5
51
51
  1. Ensure you have a clean working git branch. You will be overwriting all your files and reverting the changes that you don't want.
@@ -0,0 +1,56 @@
1
+ # Upgrading from Shakapacker v6 to v7
2
+
3
+ There will be several substantial and breaking changes in Shakapacker v7 that you need to manually account for when coming from Shakapacker v6.
4
+
5
+ ## Usages of 'webpacker' should now be 'shakapacker'
6
+
7
+ Shakapacker v6 kept the 'webpacker' spelling. As a result, many config filenames, environment variables, rake tasks, etc., used the 'webpacker' spelling. Shakapacker 7 requires renaming to the 'shakapacker' spelling.
8
+
9
+ Shakapacker v7 provides a high degree of backward compatibility for spelling changes. It displays deprecation messages in the terminal to help the developers have a smooth experience in making the required transition to the new requirements.
10
+
11
+ Please note that Shakapacker v8 will remove any backward compatibility for spelling.
12
+
13
+ ### Upgrade Steps
14
+
15
+ **Note:** At each step of changing the version, ensure that you update both gem and npm versions to the same "exact" version (like `x.y.z` and not `^x.y.z` or `>= x.y.z`).
16
+
17
+ 1. Upgrade Shakapacker to the latest 6.x version and ensure no issues running your application.
18
+ 2. Upgrade Shakapacker to version 7.
19
+ 3. Run `rake shakapacker:binstubs` to get the new files in place. Then delete the `bin/webpacker` and `bin/webpacker-dev-server` ones.
20
+ 4. Change spelling from Webpacker to Shakapacker in the code
21
+ - Change `webpacker_precompile` entry to `shakapacker_precompile` if it exists in the config file.
22
+ - Rename Ruby constant `Webpacker` to `Shakapacker` doing a global search and replace in your code. You might not be using it.
23
+ - Rename`Shakapacker.config.webpacker_precompile?` method, replace it with `Shakapacker.config.shakapacker_precompile?`
24
+ - `--debug-webpacker` is now `--debug-shakapacker` for your shakapacker binstubs.
25
+ 5. Rename files
26
+ - Rename `config/webpacker.yml` to `config/shakapacker.yml`.
27
+ - Rename environment variables from `WEBPACKER_XYZ` to `SHAKAPACKER_XYZ`.
28
+ 6. Where you have used webpackConfig, you now need to invoke it as it is a function. Alternatively, you can rename the import to globalMutableWebpackConfig which retains the v6 behavior.
29
+ 7. You may need to upgrade dependencies in package.json. You should use `yarn upgrade-interactive`. Note, some upgrades introduce issues. Some will fix issues. You may need to try a few different versions of a dependency to find one that works.
30
+
31
+
32
+ ## The `webpackConfig` property is changed
33
+
34
+ The `webpackConfig` property in the `shakapacker` module has been changed. The shakapacker module has two options:
35
+ 1. `generatedWebpackConfig`: a function that returns an immutable webpack configuration object, which ensures that any modifications made to it will not affect any other usage of the webpack configuration.
36
+ 2. `globalMutableWebpackConfig`: if a project still requires the old mutable object. You can rename your imports of `webpackConfig` with `globalMutableWebpackConfig`.
37
+
38
+ ### Example Upgrade
39
+ If you started with:
40
+
41
+ ```js
42
+ const { webpackConfig } = require('shakapacker')
43
+ ```
44
+
45
+ Swtich to:
46
+
47
+ ```js
48
+ const { generateWebpackConfig } = require('shakapacker')
49
+ const webpackConfig = generateWebpackConfig()
50
+ ```
51
+
52
+ or use `globalMutableWebpackConfig` if the project desires to use a globally mutable object.
53
+
54
+ ```js
55
+ const { globalMutableWebpackConfig: webpackConfig } = require('shakapacker')
56
+ ```
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ENV["RAILS_ENV"] ||= "development"
4
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
5
+
6
+ require "bundler/setup"
7
+ require "shakapacker"
8
+ require "shakapacker/webpack_runner"
9
+
10
+ APP_ROOT = File.expand_path("..", __dir__)
11
+ Dir.chdir(APP_ROOT) do
12
+ Shakapacker::WebpackRunner.run(ARGV)
13
+ end
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ENV["RAILS_ENV"] ||= "development"
4
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
5
+
6
+ require "bundler/setup"
7
+ require "shakapacker"
8
+ require "shakapacker/dev_server_runner"
9
+
10
+ APP_ROOT = File.expand_path("..", __dir__)
11
+ Dir.chdir(APP_ROOT) do
12
+ Shakapacker::DevServerRunner.run(ARGV)
13
+ end
@@ -1,15 +1,16 @@
1
- # Note: You must restart bin/webpacker-dev-server for changes to take effect
1
+ # Note: You must restart bin/shakapacker-dev-server for changes to take effect
2
2
 
3
3
  default: &default
4
4
  source_path: app/javascript
5
5
 
6
6
  # You can have a subdirectory of the source_path, like 'packs' (recommended).
7
7
  # Alternatively, you can use '/' to use the whole source_path directory.
8
- source_entry_path: /
8
+ # Notice that this is a relative path to source_path
9
+ source_entry_path: packs
9
10
 
10
11
  # If nested_entries is true, then we'll pick up subdirectories within the source_entry_path.
11
12
  # You cannot set this option to true if you set source_entry_path to '/'
12
- nested_entries: false
13
+ nested_entries: true
13
14
 
14
15
  # While using a File-System-based automated bundle generation feature, miscellaneous warnings suggesting css order
15
16
  # conflicts may arise due to the mini-css-extract-plugin. For projects where css ordering has been mitigated through
@@ -19,10 +20,10 @@ default: &default
19
20
 
20
21
  public_root_path: public
21
22
  public_output_path: packs
22
- cache_path: tmp/webpacker
23
+ cache_path: tmp/shakapacker
23
24
  webpack_compile_output: true
24
25
  # See https://github.com/shakacode/shakapacker#deployment
25
- webpacker_precompile: true
26
+ shakapacker_precompile: true
26
27
 
27
28
  # Location for manifest.json, defaults to {public_output_path}/manifest.json if unset
28
29
  # manifest_path: public/packs/manifest.json
@@ -51,7 +52,11 @@ development:
51
52
  # Reference: https://webpack.js.org/configuration/dev-server/
52
53
  # Keys not described there are documented inline and in https://github.com/shakacode/shakapacker/
53
54
  dev_server:
54
- https: false
55
+ # For running dev server with https, set `server: https`.
56
+ # You may use `https: true` instead but notice that it is deprecated in favor of `server: https`
57
+ # Ensure only one of these entries is set.
58
+ # server: https
59
+
55
60
  host: localhost
56
61
  port: 3035
57
62
  # Hot Module Replacement updates modules while the application is running without a full reload
@@ -78,8 +83,8 @@ development:
78
83
  # Should we use gzip compression?
79
84
  compress: true
80
85
  # Note that apps that do not check the host are vulnerable to DNS rebinding attacks
81
- allowed_hosts: 'all'
82
- # Shows progress and colorizes output of bin/webpacker[-dev-server]
86
+ allowed_hosts: 'auto'
87
+ # Shows progress and colorizes output of bin/shakapacker[-dev-server]
83
88
  pretty: true
84
89
  headers:
85
90
  'Access-Control-Allow-Origin': '*'
@@ -1,11 +1,11 @@
1
- # Install Webpacker
2
- copy_file "#{__dir__}/config/webpacker.yml", "config/webpacker.yml"
1
+ # Install Shakapacker
2
+ copy_file "#{__dir__}/config/shakapacker.yml", "config/shakapacker.yml"
3
3
  copy_file "#{__dir__}/package.json", "package.json"
4
4
 
5
5
  say "Copying webpack core config"
6
6
  directory "#{__dir__}/config/webpack", "config/webpack"
7
7
 
8
- if Dir.exist?(Webpacker.config.source_path)
8
+ if Dir.exist?(Shakapacker.config.source_path)
9
9
  say "The packs app source directory already exists"
10
10
  else
11
11
  say "Creating packs app source directory"
@@ -68,9 +68,9 @@ end
68
68
  results = []
69
69
 
70
70
  Dir.chdir(Rails.root) do
71
- if Webpacker::VERSION.match?(/^[0-9]+\.[0-9]+\.[0-9]+$/)
72
- say "Installing shakapacker@#{Webpacker::VERSION}"
73
- results << run("yarn add shakapacker@#{Webpacker::VERSION} --exact")
71
+ if Shakapacker::VERSION.match?(/^[0-9]+\.[0-9]+\.[0-9]+$/)
72
+ say "Installing shakapacker@#{Shakapacker::VERSION}"
73
+ results << run("yarn add shakapacker@#{Shakapacker::VERSION} --exact")
74
74
  else
75
75
  say "Installing shakapacker@next"
76
76
  results << run("yarn add shakapacker@next --exact")
@@ -91,6 +91,6 @@ Dir.chdir(Rails.root) do
91
91
  end
92
92
 
93
93
  unless results.all?
94
- say "Webpacker installation failed 😭 See above for details.", :red
94
+ say "Shakapacker installation failed 😭 See above for details.", :red
95
95
  exit 1
96
96
  end
@@ -1,7 +1,7 @@
1
- module Webpacker
1
+ module Shakapacker
2
2
  class BaseStrategy
3
3
  def initialize
4
- @config = Webpacker.config
4
+ @config = Shakapacker.config
5
5
  end
6
6
 
7
7
  def after_compile_hook
@@ -1,8 +1,8 @@
1
- class Webpacker::Commands
2
- delegate :config, :compiler, :manifest, :logger, to: :@webpacker
1
+ class Shakapacker::Commands
2
+ delegate :config, :compiler, :manifest, :logger, to: :@instance
3
3
 
4
- def initialize(webpacker)
5
- @webpacker = webpacker
4
+ def initialize(instance)
5
+ @instance = instance
6
6
  end
7
7
 
8
8
  # Cleanup old assets in the compile directory. By default it will
@@ -1,16 +1,17 @@
1
1
  require "open3"
2
- require "webpacker/compiler_strategy"
2
+ require "shakapacker/compiler_strategy"
3
+ require "fileutils"
3
4
 
4
- class Webpacker::Compiler
5
+ class Shakapacker::Compiler
5
6
  # Additional environment variables that the compiler is being run with
6
- # Webpacker::Compiler.env['FRONTEND_API_KEY'] = 'your_secret_key'
7
+ # Shakapacker::Compiler.env['FRONTEND_API_KEY'] = 'your_secret_key'
7
8
  cattr_accessor(:env) { {} }
8
9
 
9
- delegate :config, :logger, :strategy, to: :webpacker
10
+ delegate :config, :logger, :strategy, to: :instance
10
11
  delegate :fresh?, :stale?, :after_compile_hook, to: :strategy
11
12
 
12
- def initialize(webpacker)
13
- @webpacker = webpacker
13
+ def initialize(instance)
14
+ @instance = instance
14
15
  end
15
16
 
16
17
  def compile
@@ -32,7 +33,7 @@ class Webpacker::Compiler
32
33
  end
33
34
 
34
35
  private
35
- attr_reader :webpacker
36
+ attr_reader :instance
36
37
 
37
38
  def acquire_ipc_lock
38
39
  open_lock_file do |lf|
@@ -55,15 +56,24 @@ class Webpacker::Compiler
55
56
  end
56
57
 
57
58
  def open_lock_file
58
- lock_file_name = File.join(Dir.tmpdir, "shakapacker.lock")
59
- File.open(lock_file_name, File::CREAT) do |lf|
59
+ create_lock_file_dir unless File.exist?(lock_file_path)
60
+
61
+ File.open(lock_file_path, File::CREAT) do |lf|
60
62
  return yield lf
61
63
  end
62
64
  end
63
65
 
66
+ def create_lock_file_dir
67
+ dirname = File.dirname(lock_file_path)
68
+ FileUtils.mkdir_p(dirname)
69
+ end
70
+
71
+ def lock_file_path
72
+ config.root_path.join("tmp/shakapacker.lock")
73
+ end
74
+
64
75
  def optionalRubyRunner
65
- bin_webpack_path = config.root_path.join("bin/webpacker")
66
- first_line = File.readlines(bin_webpack_path).first.chomp
76
+ first_line = File.readlines(bin_shakapacker_path).first.chomp
67
77
  /ruby/.match?(first_line) ? RbConfig.ruby : ""
68
78
  end
69
79
 
@@ -72,7 +82,7 @@ class Webpacker::Compiler
72
82
 
73
83
  stdout, stderr, status = Open3.capture3(
74
84
  webpack_env,
75
- "#{optionalRubyRunner} ./bin/webpacker",
85
+ "#{optionalRubyRunner} #{bin_shakapacker_path}",
76
86
  chdir: File.expand_path(config.root_path)
77
87
  )
78
88
 
@@ -94,8 +104,26 @@ class Webpacker::Compiler
94
104
  def webpack_env
95
105
  return env unless defined?(ActionController::Base)
96
106
 
97
- env.merge("WEBPACKER_ASSET_HOST" => ENV.fetch("WEBPACKER_ASSET_HOST", ActionController::Base.helpers.compute_asset_host),
98
- "WEBPACKER_RELATIVE_URL_ROOT" => ENV.fetch("WEBPACKER_RELATIVE_URL_ROOT", ActionController::Base.relative_url_root),
99
- "WEBPACKER_CONFIG" => webpacker.config_path.to_s)
107
+ Shakapacker.set_shakapacker_env_variables_for_backward_compatibility
108
+
109
+ env.merge("SHAKAPACKER_ASSET_HOST" => ENV.fetch("SHAKAPACKER_ASSET_HOST", ActionController::Base.helpers.compute_asset_host),
110
+ "SHAKAPACKER_RELATIVE_URL_ROOT" => ENV.fetch("SHAKAPACKER_RELATIVE_URL_ROOT", ActionController::Base.relative_url_root),
111
+ "SHAKAPACKER_CONFIG" => instance.config_path.to_s)
112
+ end
113
+
114
+ def bin_shakapacker_path
115
+ if File.exist?(config.root_path.join("bin/shakapacker"))
116
+ config.root_path.join("bin/shakapacker")
117
+ elsif File.exist?(config.root_path.join("bin/webpacker"))
118
+ Shakapacker.puts_deprecation_message(
119
+ Shakapacker.short_deprecation_message(
120
+ "bin/webpacker",
121
+ "bin/shakapacker"
122
+ )
123
+ )
124
+ config.root_path.join("bin/webpacker")
125
+ else
126
+ config.root_path.join("bin/shakapacker")
127
+ end
100
128
  end
101
129
  end
@@ -1,16 +1,16 @@
1
- require "webpacker/mtime_strategy"
2
- require "webpacker/digest_strategy"
1
+ require "shakapacker/mtime_strategy"
2
+ require "shakapacker/digest_strategy"
3
3
 
4
- module Webpacker
4
+ module Shakapacker
5
5
  class CompilerStrategy
6
6
  def self.from_config
7
- strategy_from_config = Webpacker.config.compiler_strategy
7
+ strategy_from_config = Shakapacker.config.compiler_strategy
8
8
 
9
9
  case strategy_from_config
10
10
  when "mtime"
11
- Webpacker::MtimeStrategy.new
11
+ Shakapacker::MtimeStrategy.new
12
12
  when "digest"
13
- Webpacker::DigestStrategy.new
13
+ Shakapacker::DigestStrategy.new
14
14
  else
15
15
  raise "Unknown strategy '#{strategy_from_config}'. " \
16
16
  "Available options are 'mtime' and 'digest'."