jetpacker 0.1.0 → 0.2.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 (190) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintignore +4 -0
  3. data/.eslintrc.js +14 -0
  4. data/.gitignore +11 -11
  5. data/.node-version +1 -0
  6. data/.rubocop.yml +125 -0
  7. data/.travis.yml +54 -5
  8. data/CHANGELOG.jetpacker.md +7 -0
  9. data/CHANGELOG.md +1000 -0
  10. data/CONTRIBUTING.md +33 -0
  11. data/Gemfile +9 -3
  12. data/Gemfile.lock +157 -21
  13. data/MIT-LICENSE +20 -0
  14. data/README.md +671 -16
  15. data/Rakefile +8 -3
  16. data/docs/assets.md +119 -0
  17. data/docs/cloud9.md +310 -0
  18. data/docs/css.md +253 -0
  19. data/docs/deployment.md +130 -0
  20. data/docs/docker.md +68 -0
  21. data/docs/engines.md +200 -0
  22. data/docs/env.md +65 -0
  23. data/docs/es6.md +72 -0
  24. data/docs/folder-structure.md +66 -0
  25. data/docs/misc.md +23 -0
  26. data/docs/props.md +223 -0
  27. data/docs/testing.md +137 -0
  28. data/docs/troubleshooting.md +156 -0
  29. data/docs/typescript.md +126 -0
  30. data/docs/v4-upgrade.md +142 -0
  31. data/docs/webpack-dev-server.md +92 -0
  32. data/docs/webpack.md +364 -0
  33. data/docs/yarn.md +23 -0
  34. data/gemfiles/Gemfile-rails-edge +12 -0
  35. data/gemfiles/Gemfile-rails.4.2.x +9 -0
  36. data/gemfiles/Gemfile-rails.5.0.x +9 -0
  37. data/gemfiles/Gemfile-rails.5.1.x +9 -0
  38. data/gemfiles/Gemfile-rails.5.2.x +9 -0
  39. data/gemfiles/Gemfile-rails.6.0.x +9 -0
  40. data/jetpacker.gemspec +28 -22
  41. data/lib/install/angular.rb +23 -0
  42. data/lib/install/bin/webpack +18 -0
  43. data/lib/install/bin/webpack-dev-server +18 -0
  44. data/lib/install/binstubs.rb +4 -0
  45. data/lib/install/coffee.rb +25 -0
  46. data/lib/install/config/.browserslistrc +1 -0
  47. data/lib/install/config/babel.config.js +72 -0
  48. data/lib/install/config/postcss.config.js +12 -0
  49. data/lib/install/config/webpack/development.js +5 -0
  50. data/lib/install/config/webpack/environment.js +3 -0
  51. data/lib/install/config/webpack/production.js +5 -0
  52. data/lib/install/config/webpack/test.js +5 -0
  53. data/lib/install/config/webpacker.yml +96 -0
  54. data/lib/install/elm.rb +39 -0
  55. data/lib/install/erb.rb +25 -0
  56. data/lib/install/examples/angular/hello_angular.js +7 -0
  57. data/lib/install/examples/angular/hello_angular/app/app.component.ts +9 -0
  58. data/lib/install/examples/angular/hello_angular/app/app.module.ts +16 -0
  59. data/lib/install/examples/angular/hello_angular/index.ts +8 -0
  60. data/lib/install/examples/angular/hello_angular/polyfills.ts +73 -0
  61. data/lib/install/examples/coffee/hello_coffee.coffee +4 -0
  62. data/lib/install/examples/elm/Main.elm +55 -0
  63. data/lib/install/examples/elm/hello_elm.js +16 -0
  64. data/lib/install/examples/erb/hello_erb.js.erb +6 -0
  65. data/lib/install/examples/react/babel.config.js +87 -0
  66. data/lib/install/examples/react/hello_react.jsx +26 -0
  67. data/lib/install/examples/react/tsconfig.json +20 -0
  68. data/lib/install/examples/stimulus/application.js +1 -0
  69. data/lib/install/examples/stimulus/controllers/hello_controller.js +18 -0
  70. data/lib/install/examples/stimulus/controllers/index.js +9 -0
  71. data/lib/install/examples/svelte/app.svelte +11 -0
  72. data/lib/install/examples/svelte/hello_svelte.js +20 -0
  73. data/lib/install/examples/typescript/hello_typescript.ts +4 -0
  74. data/lib/install/examples/typescript/tsconfig.json +23 -0
  75. data/lib/install/examples/vue/app.vue +22 -0
  76. data/lib/install/examples/vue/hello_vue.js +72 -0
  77. data/lib/install/javascript/packs/application.js +18 -0
  78. data/lib/install/loaders/coffee.js +6 -0
  79. data/lib/install/loaders/elm.js +25 -0
  80. data/lib/install/loaders/erb.js +11 -0
  81. data/lib/install/loaders/svelte.js +9 -0
  82. data/lib/install/loaders/typescript.js +11 -0
  83. data/lib/install/loaders/vue.js +6 -0
  84. data/lib/install/react.rb +18 -0
  85. data/lib/install/stimulus.rb +12 -0
  86. data/lib/install/svelte.rb +29 -0
  87. data/lib/install/template.rb +55 -0
  88. data/lib/install/typescript.rb +46 -0
  89. data/lib/install/vue.rb +49 -0
  90. data/lib/jetpacker/version.rb +2 -1
  91. data/lib/tasks/installers.rake +37 -0
  92. data/lib/tasks/webpacker.rake +28 -0
  93. data/lib/tasks/webpacker/binstubs.rake +11 -0
  94. data/lib/tasks/webpacker/check_binstubs.rake +12 -0
  95. data/lib/tasks/webpacker/check_node.rake +24 -0
  96. data/lib/tasks/webpacker/check_yarn.rake +24 -0
  97. data/lib/tasks/webpacker/clean.rake +21 -0
  98. data/lib/tasks/webpacker/clobber.rake +16 -0
  99. data/lib/tasks/webpacker/compile.rake +43 -0
  100. data/lib/tasks/webpacker/info.rake +20 -0
  101. data/lib/tasks/webpacker/install.rake +13 -0
  102. data/lib/tasks/webpacker/verify_install.rake +13 -0
  103. data/lib/tasks/webpacker/yarn_install.rake +21 -0
  104. data/lib/webpacker.rb +46 -0
  105. data/lib/webpacker/commands.rb +50 -0
  106. data/lib/webpacker/compiler.rb +107 -0
  107. data/lib/webpacker/configuration.rb +113 -0
  108. data/lib/webpacker/dev_server.rb +66 -0
  109. data/lib/webpacker/dev_server_proxy.rb +31 -0
  110. data/lib/webpacker/dev_server_runner.rb +72 -0
  111. data/lib/webpacker/env.rb +39 -0
  112. data/lib/webpacker/helper.rb +176 -0
  113. data/lib/webpacker/instance.rb +37 -0
  114. data/lib/webpacker/manifest.rb +118 -0
  115. data/lib/webpacker/railtie.rb +98 -0
  116. data/lib/webpacker/rake_tasks.rb +6 -0
  117. data/lib/webpacker/runner.rb +22 -0
  118. data/lib/webpacker/version.rb +4 -0
  119. data/lib/webpacker/webpack_runner.rb +32 -0
  120. data/package.json +82 -0
  121. data/package/__tests__/config.js +55 -0
  122. data/package/__tests__/dev_server.js +43 -0
  123. data/package/__tests__/development.js +30 -0
  124. data/package/__tests__/env.js +46 -0
  125. data/package/__tests__/production.js +29 -0
  126. data/package/__tests__/staging.js +29 -0
  127. data/package/__tests__/test.js +26 -0
  128. data/package/config.js +37 -0
  129. data/package/config_types/__tests__/config_list.js +118 -0
  130. data/package/config_types/__tests__/config_object.js +43 -0
  131. data/package/config_types/config_list.js +75 -0
  132. data/package/config_types/config_object.js +55 -0
  133. data/package/config_types/index.js +7 -0
  134. data/package/dev_server.js +20 -0
  135. data/package/env.js +19 -0
  136. data/package/environments/__tests__/base.js +74 -0
  137. data/package/environments/base.js +166 -0
  138. data/package/environments/development.js +51 -0
  139. data/package/environments/production.js +79 -0
  140. data/package/environments/test.js +3 -0
  141. data/package/index.js +24 -0
  142. data/package/rules/babel.js +21 -0
  143. data/package/rules/css.js +3 -0
  144. data/package/rules/file.js +20 -0
  145. data/package/rules/index.js +20 -0
  146. data/package/rules/module.css.js +3 -0
  147. data/package/rules/module.sass.js +8 -0
  148. data/package/rules/node_modules.js +24 -0
  149. data/package/rules/sass.js +8 -0
  150. data/package/utils/__tests__/deep_assign.js +32 -0
  151. data/package/utils/__tests__/deep_merge.js +10 -0
  152. data/package/utils/__tests__/get_style_rule.js +65 -0
  153. data/package/utils/__tests__/objectify.js +9 -0
  154. data/package/utils/deep_assign.js +22 -0
  155. data/package/utils/deep_merge.js +22 -0
  156. data/package/utils/get_style_rule.js +45 -0
  157. data/package/utils/helpers.js +58 -0
  158. data/package/utils/objectify.js +3 -0
  159. data/test/command_test.rb +33 -0
  160. data/test/compiler_test.rb +75 -0
  161. data/test/configuration_test.rb +108 -0
  162. data/test/dev_server_runner_test.rb +51 -0
  163. data/test/dev_server_test.rb +47 -0
  164. data/test/env_test.rb +23 -0
  165. data/test/helper_test.rb +142 -0
  166. data/test/manifest_test.rb +42 -0
  167. data/test/rake_tasks_test.rb +69 -0
  168. data/test/test_app/Rakefile +3 -0
  169. data/test/test_app/app/javascript/packs/application.js +10 -0
  170. data/test/test_app/bin/webpack +14 -0
  171. data/test/test_app/bin/webpack-dev-server +14 -0
  172. data/test/test_app/config.ru +5 -0
  173. data/test/test_app/config/application.rb +12 -0
  174. data/test/test_app/config/environment.rb +4 -0
  175. data/test/test_app/config/webpack/development.js +0 -0
  176. data/test/test_app/config/webpacker.yml +97 -0
  177. data/test/test_app/config/webpacker_public_root.yml +19 -0
  178. data/test/test_app/package.json +13 -0
  179. data/test/test_app/public/packs/manifest.json +31 -0
  180. data/test/test_app/yarn.lock +11 -0
  181. data/test/test_helper.rb +33 -0
  182. data/test/webpack_runner_test.rb +51 -0
  183. data/test/webpacker_test.rb +13 -0
  184. data/yarn.lock +8321 -0
  185. metadata +267 -29
  186. data/.rspec +0 -3
  187. data/LICENSE.txt +0 -21
  188. data/bin/console +0 -14
  189. data/bin/setup +0 -8
  190. data/lib/jetpacker.rb +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef03e18af915e79dd45950481c6ee585447acbf9dae667703e2cc2201633574a
4
- data.tar.gz: 97923c956b3a717b1de162aa3537f3b6004aade895d0f6ffb68ebae6e429f87a
3
+ metadata.gz: a00570fefc0c4e76f3289c1c6d3ed59c20b54bcbfb1e5a8ec1b4a84c104410d2
4
+ data.tar.gz: de97f5369124394e52aa84a31e96676da1500338a69f7a44d5ac7725045e50df
5
5
  SHA512:
6
- metadata.gz: c3c492b00efb3e1fda1a7f07b4b4931358abe128491ed0a670d355efa65638c363b945e54cd7c51b481b27e035ed0ba21293896497fd49aea678e792deb70dc6
7
- data.tar.gz: 5de7246f8fddbfcbdb1b2784bc3810b60d82050df5adc74c7d995808d00c7b0c9036b0f3acdb25dd4a2be40af8ca49aa9fa576d2ad1ae8b290adbd8a3af38e6b
6
+ metadata.gz: 49eedc14aefafe5c2f614b2c92b374921073fd3cd162c89dbd3214cb4e8b60acd70372c5942aa037f546407d873e447297ca58826b9fb879b9ee21e15a1244f0
7
+ data.tar.gz: 34fe907c6cc638fa021f3226cbe95ee0d4a6f4bd7164873206284da5aeb9de2df201c1e9e19d25d45fd5731cca2df02ac3b5c83d8edb5cac7973f07f9a63fb1a
@@ -0,0 +1,4 @@
1
+ lib/*
2
+ node_modules/*
3
+ vendor/*
4
+ **/__tests__/**/*
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ 'extends': 'airbnb',
3
+ 'rules': {
4
+ 'comma-dangle': ['error', 'never'],
5
+ 'import/no-unresolved': 'off',
6
+ 'import/no-extraneous-dependencies': 'off',
7
+ 'import/extensions': 'off',
8
+ semi: ['error', 'never'],
9
+ },
10
+ 'env': {
11
+ 'browser': true,
12
+ 'node': true,
13
+ },
14
+ };
data/.gitignore CHANGED
@@ -1,11 +1,11 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
1
+ /.bundle
2
+ /pkg
3
+ /test/test_app/log
4
+ node_modules
5
+ .byebug_history
6
+ /test/test_app/tmp
7
+ yarn-debug.log*
8
+ yarn-error.log*
9
+ .yarn-integrity
10
+ /log
11
+ gemfiles/*.lock
@@ -0,0 +1 @@
1
+ 8.16.0
@@ -0,0 +1,125 @@
1
+ require: rubocop-performance
2
+ AllCops:
3
+ TargetRubyVersion: 2.2
4
+ # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
5
+ # to ignore them, so only the ones explicitly set in this file are enabled.
6
+ DisabledByDefault: true
7
+ Exclude:
8
+ - 'lib/install/templates/**'
9
+ - 'vendor/**/*'
10
+ - 'node_modules/**/*'
11
+
12
+ # Prefer &&/|| over and/or.
13
+ Style/AndOr:
14
+ Enabled: true
15
+
16
+ # Do not use braces for hash literals when they are the last argument of a
17
+ # method call.
18
+ Style/BracesAroundHashParameters:
19
+ Enabled: true
20
+
21
+ # Align `when` with `case`.
22
+ Layout/CaseIndentation:
23
+ Enabled: true
24
+
25
+ # Align comments with method definitions.
26
+ Layout/CommentIndentation:
27
+ Enabled: true
28
+
29
+ # No extra empty lines.
30
+ Layout/EmptyLines:
31
+ Enabled: true
32
+
33
+ # In a regular class definition, no empty lines around the body.
34
+ Layout/EmptyLinesAroundClassBody:
35
+ Enabled: true
36
+
37
+ # In a regular method definition, no empty lines around the body.
38
+ Layout/EmptyLinesAroundMethodBody:
39
+ Enabled: true
40
+
41
+ # In a regular module definition, no empty lines around the body.
42
+ Layout/EmptyLinesAroundModuleBody:
43
+ Enabled: true
44
+
45
+ # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
46
+ Style/HashSyntax:
47
+ Enabled: true
48
+
49
+ # Method definitions after `private` or `protected` isolated calls need one
50
+ # extra level of indentation.
51
+ Layout/IndentationConsistency:
52
+ Enabled: true
53
+ EnforcedStyle: rails
54
+
55
+ # Two spaces, no tabs (for indentation).
56
+ Layout/IndentationWidth:
57
+ Enabled: true
58
+
59
+ Layout/SpaceAfterColon:
60
+ Enabled: true
61
+
62
+ Layout/SpaceAfterComma:
63
+ Enabled: true
64
+
65
+ Layout/SpaceAroundEqualsInParameterDefault:
66
+ Enabled: true
67
+
68
+ Layout/SpaceAroundKeyword:
69
+ Enabled: true
70
+
71
+ Layout/SpaceAroundOperators:
72
+ Enabled: true
73
+
74
+ Layout/SpaceBeforeFirstArg:
75
+ Enabled: true
76
+
77
+ # Defining a method with parameters needs parentheses.
78
+ Style/MethodDefParentheses:
79
+ Enabled: true
80
+
81
+ # Use `foo {}` not `foo{}`.
82
+ Layout/SpaceBeforeBlockBraces:
83
+ Enabled: true
84
+
85
+ # Use `foo { bar }` not `foo {bar}`.
86
+ Layout/SpaceInsideBlockBraces:
87
+ Enabled: true
88
+
89
+ # Use `{ a: 1 }` not `{a:1}`.
90
+ Layout/SpaceInsideHashLiteralBraces:
91
+ Enabled: true
92
+
93
+ Layout/SpaceInsideParens:
94
+ Enabled: true
95
+
96
+ # Check quotes usage according to lint rule below.
97
+ Style/StringLiterals:
98
+ Enabled: true
99
+ EnforcedStyle: double_quotes
100
+
101
+ # Detect hard tabs, no hard tabs.
102
+ Layout/Tab:
103
+ Enabled: true
104
+
105
+ # Blank lines should not have any spaces.
106
+ Layout/TrailingBlankLines:
107
+ Enabled: true
108
+
109
+ # No trailing whitespace.
110
+ Layout/TrailingWhitespace:
111
+ Enabled: true
112
+
113
+ # Use quotes for string literals when they are enough.
114
+ Style/UnneededPercentQ:
115
+ Enabled: true
116
+
117
+ # Align `end` with the matching keyword or starting expression except for
118
+ # assignments, where it should be aligned with the LHS.
119
+ Layout/EndAlignment:
120
+ Enabled: true
121
+ EnforcedStyleAlignWith: variable
122
+
123
+ # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
124
+ Lint/RequireParentheses:
125
+ Enabled: true
@@ -1,7 +1,56 @@
1
- ---
2
- sudo: false
3
1
  language: ruby
4
- cache: bundler
2
+ dist: xenial
3
+ before_install:
4
+ - gem install rubygems-update -v 3.0.6 && update_rubygems
5
+ # Rails 4.2 doesn't support bundler 2.0, so we need to lock bundler to
6
+ # v1.17.3. This is just for Ruby 2.5 which ships with bundler 2.x on Travis
7
+ # CI while Ruby 2.6 does not.
8
+ # https://github.com/travis-ci/travis-rubies/issues/57#issuecomment-458981237
9
+ - yes | rvm @global do gem install bundler -v 1.17.3 || true
5
10
  rvm:
6
- - 2.5.3
7
- before_install: gem install bundler -v 1.17.2
11
+ - 2.3.8
12
+ - 2.4.6
13
+ - 2.5.5
14
+ - 2.6.3
15
+ - ruby-head
16
+ gemfile:
17
+ - gemfiles/Gemfile-rails.4.2.x
18
+ - gemfiles/Gemfile-rails.5.0.x
19
+ - gemfiles/Gemfile-rails.5.1.x
20
+ - gemfiles/Gemfile-rails.5.2.x
21
+ - gemfiles/Gemfile-rails.6.0.x
22
+ - gemfiles/Gemfile-rails-edge
23
+ cache:
24
+ bundler: true
25
+ directories:
26
+ - node_modules
27
+ yarn: true
28
+
29
+ install:
30
+ - bundle install --jobs 3 --retry 3
31
+ - nvm install 10
32
+ - node -v
33
+ - npm i -g yarn
34
+ - yarn
35
+ script:
36
+ - yarn lint
37
+ - yarn test
38
+ - bundle exec rubocop
39
+ - bundle exec rake test
40
+ matrix:
41
+ allow_failures:
42
+ - gemfile: gemfiles/Gemfile-rails-edge
43
+ - rvm: ruby-head
44
+ exclude:
45
+ - rvm: 2.3.8
46
+ gemfile: gemfiles/Gemfile-rails-edge
47
+ - rvm: 2.4.6
48
+ gemfile: gemfiles/Gemfile-rails-edge
49
+ - rvm: 2.5.5
50
+ gemfile: gemfiles/Gemfile-rails-edge
51
+ - rvm: ruby-head
52
+ gemfile: gemfiles/Gemfile-rails.4.2.x
53
+ - rvm: 2.3.8
54
+ gemfile: gemfiles/Gemfile-rails.6.0.x
55
+ - rvm: 2.4.6
56
+ gemfile: gemfiles/Gemfile-rails.6.0.x
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
+
6
+ ## [0.2.0]
7
+ - actual initial release
@@ -0,0 +1,1000 @@
1
+ **Please note that Webpacker 3.1.0 and 3.1.1 have some serious bugs so please consider using either 3.0.2 or 3.2.0**
2
+
3
+ **Please note that Webpacker 4.1.0 has an installer bug. Please use 4.2.0 or above**
4
+
5
+ ## [[4.2.2]](https://github.com/rails/webpacker/compare/v4.2.1...v4.2.2) - 2019-12-09
6
+
7
+ - Fixed issue with webpack clean task for nested assets [#2391](https://github.com/rails/webpacker/pull/2391)
8
+
9
+ ## [[4.2.1]](https://github.com/rails/webpacker/compare/v4.2.0...v4.2.1) - 2019-12-09
10
+
11
+ - Fixed issue with webpack clean task [#2389](https://github.com/rails/webpacker/pull/2389)
12
+
13
+ ## [[4.2.0]](https://github.com/rails/webpacker/compare/v4.1.0...v4.2.0) - 2019-11-12
14
+
15
+ - Fixed installer bug [#2366](https://github.com/rails/webpacker/pull/2366)
16
+
17
+ ## [[4.1.0]](https://github.com/rails/webpacker/compare/v4.0.7...v4.1.0) - 2019-11-12
18
+
19
+ - Added favicon_pack_tag to generate favicon links [#2281](https://github.com/rails/webpacker/pull/2281)
20
+ - Add support for Brotli compression [#2273](https://github.com/rails/webpacker/pull/2273)
21
+ - Support .(sass|scss).erb [#2259](https://github.com/rails/webpacker/pull/2259)
22
+ - Elm: Enable production optimizations when compiling in production [#2234](https://github.com/rails/webpacker/pull/2234)
23
+ - fixes webpacker:clean erroring because of nested hashes [#2318](https://github.com/rails/webpacker/pull/2318)
24
+ - Revert of production env enforcement [#2341](https://github.com/rails/webpacker/pull/2341)
25
+ - Add a preload_pack_asset helper [#2124](https://github.com/rails/webpacker/pull/2124)
26
+ - Record the compilation digest even on webpack error [#2117](https://github.com/rails/webpacker/pull/2117)
27
+ - See more changes [here](https://github.com/rails/webpacker/compare/v4.0.7...v4.1.0)
28
+
29
+ ## [[4.0.7]](https://github.com/rails/webpacker/compare/v4.0.6...v4.0.7) - 2019-06-03
30
+
31
+ - Prevent `@babel/plugin-transform-runtime` from rewriting babel helpers in core-js. Remove unneeded runtime `@babel/runtime-corejs3` [#2116](https://github.com/rails/webpacker/pull/2116)
32
+ - Fix for: [#2109 Uncaught TypeError: **webpack_require**(...) is not a function](https://github.com/rails/webpacker/issues/2109): **If you are upgrading**, please check your `babel.config.js` against the [default `babel.config.js`](https://github.com/rails/webpacker/blob/master/lib/install/config/babel.config.js):
33
+ - `@babel/preset-env` should contain `corejs: 3`
34
+ - `@babel/plugin-transform-runtime` should contain `corejs: false`
35
+ - Removed unneeded runtime `@babel/runtime-corejs3`
36
+
37
+ ## [[4.0.6]](https://github.com/rails/webpacker/compare/v4.0.5...v4.0.6) - 2019-05-30
38
+
39
+ - Webpack should not be transpiled [#2111](https://github.com/rails/webpacker/pull/2111)
40
+
41
+ ## [[4.0.5]](https://github.com/rails/webpacker/compare/v4.0.4...v4.0.5) - 2019-05-30
42
+
43
+ - Don't let babel & core-js transpile each other [#2110](https://github.com/rails/webpacker/pull/2110)
44
+
45
+ ## [[4.0.4]](https://github.com/rails/webpacker/compare/v4.0.3...v4.0.4) - 2019-05-28
46
+
47
+ - Remove bundler version constraint
48
+
49
+ ## [[4.0.3]](https://github.com/rails/webpacker/compare/v4.0.2...v4.0.3) - 2019-05-28
50
+
51
+ Please see the diff
52
+
53
+ ##### Breaking changes (for pre-existing apps)
54
+
55
+ - [`@babel/polyfill`](https://babeljs.io/docs/en/next/babel-polyfill.html) [doesn't make it possible to provide a smooth migration path from `core-js@2` to `core-js@3`](https://github.com/zloirock/core-js/blob/master/docs/2019-03-19-core-js-3-babel-and-a-look-into-the-future.md#babelpolyfill): for this reason, it was decided to deprecate `@babel/polyfill` in favor of separate inclusion of required parts of `core-js` and `regenerator-runtime`. [#2031](https://github.com/rails/webpacker/pull/2031)
56
+
57
+ In each of your `/packs/*.js` files, change this:
58
+
59
+ ```js
60
+ import '@babel/polyfill'
61
+ ```
62
+
63
+ to this:
64
+
65
+ ```js
66
+ import 'core-js/stable'
67
+ import 'regenerator-runtime/runtime'
68
+ ```
69
+
70
+ Don't forget to install those dependencies directly!
71
+
72
+ ```sh
73
+ yarn add core-js regenerator-runtime
74
+ ```
75
+
76
+ ## [4.0.2] - 2019-03-06
77
+
78
+ - Bump the version on npm
79
+
80
+ ## [4.0.1] - 2019-03-04
81
+
82
+ ### Fixed
83
+
84
+ - Pre-release version installer
85
+
86
+ ## [4.0.0] - 2019-03-04
87
+
88
+ No changes in this release. See RC releases for changes.
89
+
90
+ ## [4.0.0.rc.8] - 2019-03-03
91
+
92
+ ### Fixed
93
+
94
+ - Re-enable source maps in production to make debugging in production
95
+ easier. Enabling source maps doesn't have drawbacks for most of the
96
+ applications since maps are compressed by default and aren't loaded
97
+ by browsers unless Dev Tools are opened.
98
+
99
+ Source maps can be disabled in any environment configuration, e.g:
100
+
101
+ ```js
102
+ // config/webpack/production.js
103
+
104
+ const environment = require('./environment')
105
+ environment.config.merge({ devtool: 'none' })
106
+
107
+ module.exports = environment.toWebpackConfig()
108
+ ```
109
+
110
+ - Reintroduced `context` to the file loader. Reverting the simpler paths change
111
+
112
+ - Updated file loader to have filename based on the path. This change
113
+ keeps the old behaviour intact i.e. let people use namespaces for media
114
+ inside `app/javascript` and also include media outside of `app/javascript`
115
+ with simpler paths, for example from `node_modules` or `app/assets`
116
+
117
+ ```bash
118
+ # Files inside app/javascript (i.e. packs source path)
119
+ # media/[full_path_relative_to_app_javascript]/name_of_the_asset_with_digest
120
+ media/images/google-97e897b3851e415bec4fd30c265eb3ce.jpg
121
+ media/images/rails-45b116b1f66cc5e6f9724e8f9a2db73d.png
122
+ media/images/some_namespace/google-97e897b3851e415bec4fd30c265eb3ce.jpg
123
+
124
+ # Files outside app/javascript (i.e. packs source path)
125
+ # media/[containing_folder_name]/name_of_the_asset_with_digest
126
+ media/some_assets/rails_assets-f0f7bbb5.png
127
+ media/webfonts/fa-brands-400-4b115e11.woff2
128
+ ```
129
+
130
+ This change is done so we don't end up paths like `media/_/assets/images/rails_assets-f0f7bbb5ef00110a0dcef7c2cb7d34a6.png` or `media/_/_/node_modules/foo-f0f7bbb5ef00110a0dcef7c2cb7d34a6.png` for media outside of
131
+ `app/javascript`
132
+
133
+ ## [4.0.0.rc.7] - 2019-01-25
134
+
135
+ ### Fixed
136
+
137
+ - Webpacker builds test app assets [#1908](https://github.com/rails/webpacker/issues/1908)
138
+
139
+ ## [4.0.0.rc.6] - 2019-01-25
140
+
141
+ ### Fixed
142
+
143
+ - Remove `context` from file loader in favour of simpler paths
144
+
145
+ ```rb
146
+ # before
147
+ "_/assets/images/avatar.png": "/packs/_/assets/images/avatar-057862c747f0fdbeae506bdd0516cad1.png"
148
+
149
+ # after
150
+ "media/avatar.png": "/packs/media/avatar-057862c747f0fdbeae506bdd0516cad1.png"
151
+ ```
152
+
153
+ To get old behaviour:
154
+
155
+ ```js
156
+ // config/webpack/environment.js
157
+
158
+ const { environment, config } = require('@rails/webpacker')
159
+ const { join } = require('path')
160
+
161
+ const fileLoader = environment.loaders.get('file')
162
+ fileLoader.use[0].options.name = '[path][name]-[hash].[ext]'
163
+ fileLoader.use[0].options.context = join(config.source_path) // optional if you don't want to expose full paths
164
+ ```
165
+
166
+ ### Added
167
+
168
+ - Namespaces for compiled packs in the public directory
169
+
170
+ ```rb
171
+ # before
172
+ "runtime~hello_react" => "/packs/runtime~hello_react-da2baf7fd07b0e8b6d17.js"
173
+
174
+ # after
175
+ "runtime~hello_react" => "/packs/js/runtime~hello_react-da2baf7fd07b0e8b6d17.js"
176
+ ```
177
+
178
+ ## [4.0.0.rc.5] - 2019-01-21
179
+
180
+ ### Updated
181
+
182
+ - Gems and node dependencies
183
+
184
+ ## [4.0.0.rc.4] - 2019-01-21
185
+
186
+ ### Added
187
+
188
+ - `stylesheet_packs_with_chunks_tag` helper, similar to javascript helper but for
189
+ loading stylesheets chunks.
190
+
191
+ ```erb
192
+ <%= stylesheet_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
193
+
194
+ <link rel="stylesheet" media="screen" href="/packs/3-8c7ce31a.chunk.css" />
195
+ <link rel="stylesheet" media="screen" href="/packs/calendar-8c7ce31a.chunk.css" />
196
+ <link rel="stylesheet" media="screen" href="/packs/map-8c7ce31a.chunk.css" />
197
+ ```
198
+
199
+ **Important:** Pass all your pack names when using `stylesheet_packs_with_chunks_tag`
200
+ helper otherwise you will get duplicated chunks on the page.
201
+
202
+ ```erb
203
+ <%# DO %>
204
+ # <%= stylesheet_packs_with_chunks_tag 'calendar', 'map' %>
205
+ <%# DON'T %>
206
+ # <%= stylesheet_packs_with_chunks_tag 'calendar' %>
207
+ # <%= stylesheet_packs_with_chunks_tag 'map' %>
208
+ ```
209
+
210
+ ## [4.0.0.rc.3] - 2019-01-17
211
+
212
+ ### Fixed
213
+
214
+ - Issue with javascript_pack_tag asset duplication [#1898](https://github.com/rails/webpacker/pull/1898)
215
+
216
+ ### Added
217
+
218
+ - `javascript_packs_with_chunks_tag` helper, which creates html tags
219
+ for a pack and all the dependent chunks, when using splitchunks.
220
+
221
+ ```erb
222
+ <%= javascript_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
223
+
224
+ <script src="/packs/vendor-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
225
+ <script src="/packs/calendar~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
226
+ <script src="/packs/calendar-1016838bab065ae1e314.js" data-turbolinks-track="reload"></script>
227
+ <script src="/packs/map~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
228
+ <script src="/packs/map-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
229
+ ```
230
+
231
+ **Important:** Pass all your pack names when using `javascript_packs_with_chunks_tag`
232
+ helper otherwise you will get duplicated chunks on the page.
233
+
234
+ ```erb
235
+ <%# DO %>
236
+ <%= javascript_packs_with_chunks_tag 'calendar', 'map' %>
237
+
238
+ <%# DON'T %>
239
+ <%= javascript_packs_with_chunks_tag 'calendar' %>
240
+ <%= javascript_packs_with_chunks_tag 'map' %>
241
+ ```
242
+
243
+ ## [4.0.0.rc.2] - 2018-12-15
244
+
245
+ ### Fixed
246
+
247
+ - Disable integrity hash generation [#1835](https://github.com/rails/webpacker/issues/1835)
248
+
249
+ ## [4.0.0.rc.1] - 2018-12-14
250
+
251
+ ### Breaking changes
252
+
253
+ - Order of rules changed so you might have to change append to prepend,
254
+ depending on how you want to process packs [#1823](https://github.com/rails/webpacker/pull/1823)
255
+
256
+ ```js
257
+ environment.loaders.prepend()
258
+ ```
259
+
260
+ - Separate CSS extraction from build environment [#1625](https://github.com/rails/webpacker/pull/1625)
261
+
262
+ ```yml
263
+ # Extract and emit a css file
264
+ extract_css: true
265
+ ```
266
+
267
+ - Separate rule to compile node modules
268
+ (fixes cases where ES6 libraries were included in the app code) [#1823](https://github.com/rails/webpacker/pull/1823).
269
+
270
+ In previous versions only application code was transpiled. Now everything in `node_modules` is transpiled with Babel. In some cases it could break your build (known issue with `mapbox-gl` package being broken by Babel, https://github.com/mapbox/mapbox-gl-js/issues/3422).
271
+
272
+ [`nodeModules` loader](https://github.com/rails/webpacker/pull/1823/files#diff-456094c8451b5774db50028dfecf4aa8) ignores `config.babel.js` and uses hard-coded `'@babel/preset-env', { modules: false }` config.
273
+
274
+ To keep previous behavior, remove `nodeModules` loader specifying `environment.loaders.delete('nodeModules');` in your `config/webpack/environment.js` file.
275
+
276
+ - File loader extensions API [#1823](https://github.com/rails/webpacker/pull/1823)
277
+
278
+ ```yml
279
+ # webpacker.yml
280
+ static_assets_extensions:
281
+ - .pdf
282
+ # etc..
283
+ ```
284
+
285
+ ### Added
286
+
287
+ - Move `.babelrc` and `.postcssrc` to `.js` variant [#1822](https://github.com/rails/webpacker/pull/1822)
288
+ - Use postcss safe parser when optimising css assets [#1822](https://github.com/rails/webpacker/pull/1822)
289
+ - Add split chunks api (undocumented)
290
+
291
+ ```js
292
+ const { environment } = require('@rails/webpacker')
293
+ // Enable with default config
294
+ environment.splitChunks()
295
+ // Configure via a callback
296
+ environment.splitChunks(config =>
297
+ Object.assign({}, config, { optimization: { splitChunks: false } })
298
+ )
299
+ ```
300
+
301
+ - Allow changing static file extensions using webpacker.yml (undocumented)
302
+
303
+ ## [4.0.0-pre.3] - 2018-10-01
304
+
305
+ ### Added
306
+
307
+ - Move supported browsers configuration to [.browserslistrc](https://github.com/browserslist/browserslist#queries)
308
+
309
+ ### Breaking changes
310
+
311
+ - postcss-next is replaced with postcss-preset-env
312
+ - babel@7
313
+
314
+ ### Fixed
315
+
316
+ - Bring back test env [#1563](https://github.com/rails/webpacker/pull/1563)
317
+
318
+ Please see a list of [commits](https://github.com/rails/webpacker/compare/2dd68f0273074aadb3f869c4c30369d5e4e3fea7...master)
319
+
320
+ ## [4.0.0-pre.2] - 2018-04-2
321
+
322
+ ### Fixed
323
+
324
+ - Webpack dev server version in installer
325
+
326
+ ## [4.0.0-pre.1] - 2018-04-2
327
+
328
+ Pre-release to try out webpack 4.0 support
329
+
330
+ ### Added
331
+
332
+ - Webpack 4.0 support [#1376](https://github.com/rails/webpacker/pull/1316)
333
+
334
+ ### Fixed
335
+
336
+ - Remove compilation digest file if webpack command fails[#1398](https://github.com/rails/webpacker/issues/1398)
337
+
338
+ ## [3.6.0] - 2019-03-06
339
+
340
+ See changes: https://github.com/rails/webpacker/compare/88a253ed42966eb2d5c997435e9396881513bce1...3-x-stable
341
+
342
+ ## [3.5.5] - 2018-07-09
343
+
344
+ See changes: https://github.com/rails/webpacker/compare/e8b197e36c77181ca2e4765c620faea59dcd0351...3-x-stable
345
+
346
+ ### Added
347
+
348
+ - On CI, sort files & check modified w/ digest intead of mtime[#1522](https://github.com/rails/webpacker/pull/1522)
349
+
350
+ ## [3.5.3] - 2018-05-03
351
+
352
+ ### Fixed
353
+
354
+ - Relax Javascript package dependencies [#1466](https://github.com/rails/webpacker/pull/1466#issuecomment-386336605)
355
+
356
+ ## [3.5.2] - 2018-04-29
357
+
358
+ - Pin Javascript package to 3.5.x
359
+
360
+ ## [3.5.1] - 2018-04-29
361
+
362
+ - Upgraded gems and Javascript packages
363
+
364
+ ## [3.5.0] - 2018-04-29
365
+
366
+ ### Fixed
367
+
368
+ - Remove compilation digest file if webpack command fails [#1399](https://github.com/rails/webpacker/pull/1399)
369
+ - Handle http dev_server setting properly in the proxy [#1420](https://github.com/rails/webpacker/pull/1420)
370
+ - Use correct protocol [#1425](https://github.com/rails/webpacker/pull/1425)
371
+
372
+ ### Added
373
+
374
+ - `image_pack_tag` helper [#1400](https://github.com/rails/webpacker/pull/1400)
375
+ - devserver proxy for custom environments [#1415](https://github.com/rails/webpacker/pull/1415)
376
+ - Rails webpacker:info task [#1416](https://github.com/rails/webpacker/pull/1416)
377
+ - Include `RAILS_RELATIVE_URL_ROOT` environment variable in publicPath [#1428](https://github.com/rails/webpacker/pull/1428)
378
+
379
+ Complete list of changes: [#1464](https://github.com/rails/webpacker/pull/1464)
380
+
381
+ ## [3.4.3] - 2018-04-3
382
+
383
+ ### Fixed
384
+
385
+ - Lock webpacker version in installer [#1401](https://github.com/rails/webpacker/issues/1401)
386
+
387
+ ## [3.4.1] - 2018-03-24
388
+
389
+ ### Fixed
390
+
391
+ - Yarn integrity check in development [#1374](https://github.com/rails/webpacker/issues/1374)
392
+
393
+ ## [3.4.0] - 2018-03-23
394
+
395
+ **Please use 3.4.1 instead**
396
+
397
+ ### Added
398
+
399
+ - Support for custom Rails environments [#1359](https://github.com/rails/webpacker/pull/1359)
400
+
401
+ _This could break the compilation if you set NODE_ENV to custom environment. Now, NODE_ENV only understands production or development mode_
402
+
403
+ ## [3.3.1] - 2018-03-12
404
+
405
+ ### Fixed
406
+
407
+ - Use webpack dev server 2.x until webpacker supports webpack 4.x [#1338](https://github.com/rails/webpacker/issues/1338)
408
+
409
+ ## [3.3.0] - 2018-03-03
410
+
411
+ ### Added
412
+
413
+ - Separate task for installing/updating binstubs
414
+ - CSS modules support [#1248](https://github.com/rails/webpacker/pull/1248)
415
+ - Pass `relative_url_root` to webpacker config [#1236](https://github.com/rails/webpacker/pull/1236)
416
+
417
+ ### Breaking changes
418
+
419
+ - Fixes [#1281](https://github.com/rails/webpacker/issues/1281) by installing binstubs only as local executables. To upgrade:
420
+
421
+ ```
422
+ bundle exec rails webpacker:binstubs
423
+ ```
424
+
425
+ - set function is now removed from plugins and loaders, please use `append` or `prepend`
426
+
427
+ ```js
428
+ // config/webpack/environment.js
429
+ const { environment } = require('@rails/webpacker')
430
+
431
+ environment.loaders.append('json', {
432
+ test: /\.json$/,
433
+ use: 'json-loader'
434
+ })
435
+ ```
436
+
437
+ ### Fixed
438
+
439
+ - Limit ts-loader to 3.5.0 until webpack 4 support [#1308](https://github.com/rails/webpacker/pull/1308)
440
+ - Custom env support [#1304](https://github.com/rails/webpacker/pull/1304)
441
+
442
+ ## [3.2.2] - 2018-02-11
443
+
444
+ ### Added
445
+
446
+ - Stimulus example [https://stimulusjs.org/](https://stimulusjs.org/)
447
+
448
+ ```bash
449
+ bundle exec rails webpacker:install:stimulus
450
+ ```
451
+
452
+ - Upgrade gems and npm packages [#1254](https://github.com/rails/webpacker/pull/1254)
453
+
454
+ And, bunch of bug fixes [See changes](https://github.com/rails/webpacker/compare/v3.2.1...v3.2.2)
455
+
456
+ ## [3.2.1] - 2018-01-21
457
+
458
+ - Disable dev server running? check if no dev server config is present in that environment [#1179](https://github.com/rails/webpacker/pull/1179)
459
+
460
+ - Fix checking 'webpack' binstub on Windows [#1123](https://github.com/rails/webpacker/pull/1123)
461
+
462
+ - silence yarn output if checking is successful [#1131](https://github.com/rails/webpacker/pull/1131)
463
+
464
+ - Update uglifyJs plugin to support ES6 [#1194](https://github.com/rails/webpacker/pull/1194)
465
+
466
+ - Add typescript installer [#1145](https://github.com/rails/webpacker/pull/1145)
467
+
468
+ - Update default extensions and move to installer [#1181](https://github.com/rails/webpacker/pull/1181)
469
+
470
+ - Revert file loader [#1196](https://github.com/rails/webpacker/pull/1196)
471
+
472
+ ## [3.2.0] - 2017-12-16
473
+
474
+ ### To upgrade:
475
+
476
+ ```bash
477
+ bundle update webpacker
478
+ yarn upgrade @rails/webpacker
479
+ ```
480
+
481
+ ### Breaking changes
482
+
483
+ If you are using react, vue, angular, elm, erb or coffeescript inside your
484
+ `packs/` please re-run the integration installers as described in the README.
485
+
486
+ ```bash
487
+ bundle exec rails webpacker:install:react
488
+ bundle exec rails webpacker:install:vue
489
+ bundle exec rails webpacker:install:angular
490
+ bundle exec rails webpacker:install:elm
491
+ bundle exec rails webpacker:install:erb
492
+ bundle exec rails webpacker:install:coffee
493
+ ```
494
+
495
+ Or simply copy required loaders used in your app from
496
+ https://github.com/rails/webpacker/tree/master/lib/install/loaders
497
+ into your `config/webpack/loaders/`
498
+ directory and add it to webpack build from `config/webpack/environment.js`
499
+
500
+ ```js
501
+ const erb = require('./loaders/erb')
502
+ const elm = require('./loaders/elm')
503
+ const typescript = require('./loaders/typescript')
504
+ const vue = require('./loaders/vue')
505
+ const coffee = require('./loaders/coffee')
506
+
507
+ environment.loaders.append('coffee', coffee)
508
+ environment.loaders.append('vue', vue)
509
+ environment.loaders.append('typescript', typescript)
510
+ environment.loaders.append('elm', elm)
511
+ environment.loaders.append('erb', erb)
512
+ ```
513
+
514
+ In `.postcssrc.yml` you need to change the plugin name from `postcss-smart-import` to `postcss-import`:
515
+
516
+ ```yml
517
+ plugins:
518
+ postcss-import: {}
519
+ postcss-cssnext: {}
520
+ ```
521
+
522
+ ### Added (npm module)
523
+
524
+ - Upgrade gems and webpack dependencies
525
+
526
+ - `postcss-import` in place of `postcss-smart-import`
527
+
528
+ ### Removed (npm module)
529
+
530
+ - `postcss-smart-import`, `coffee-loader`, `url-loader`, `rails-erb-loader` as dependencies
531
+
532
+ - `publicPath` from file loader [#1107](https://github.com/rails/webpacker/pull/1107)
533
+
534
+ ### Fixed (npm module)
535
+
536
+ - Return native array type for `ConfigList` [#1098](https://github.com/rails/webpacker/pull/1098)
537
+
538
+ ### Added (Gem)
539
+
540
+ - New `asset_pack_url` helper [#1102](https://github.com/rails/webpacker/pull/1102)
541
+
542
+ - New installers for coffee and erb
543
+
544
+ ```bash
545
+ bundle exec rails webpacker:install:erb
546
+ bundle exec rails webpacker:install:coffee
547
+ ```
548
+
549
+ - Resolved paths from webpacker.yml to compiler watched list
550
+
551
+ ## [3.1.1] - 2017-12-11
552
+
553
+ ### Fixed
554
+
555
+ - Include default webpacker.yml config inside npm package
556
+
557
+ ## [3.1.0] - 2017-12-11
558
+
559
+ ### Added (npm module)
560
+
561
+ - Expose base config from environment
562
+
563
+ ```js
564
+ environment.config.set('resolve.extensions', ['.foo', '.bar'])
565
+ environment.config.set('output.filename', '[name].js')
566
+ environment.config.delete('output.chunkFilename')
567
+ environment.config.get('resolve')
568
+ environment.config.merge({
569
+ output: {
570
+ filename: '[name].js'
571
+ }
572
+ })
573
+ ```
574
+
575
+ - Expose new API's for loaders and plugins to insert at position
576
+
577
+ ```js
578
+ const jsonLoader = {
579
+ test: /\.json$/,
580
+ exclude: /node_modules/,
581
+ loader: 'json-loader'
582
+ }
583
+
584
+ environment.loaders.append('json', jsonLoader)
585
+ environment.loaders.prepend('json', jsonLoader)
586
+ environment.loaders.insert('json', jsonLoader, { after: 'style' })
587
+ environment.loaders.insert('json', jsonLoader, { before: 'babel' })
588
+
589
+ // Update a plugin
590
+ const manifestPlugin = environment.plugins.get('Manifest')
591
+ manifestPlugin.opts.writeToFileEmit = false
592
+
593
+ // Update coffee loader to use coffeescript 2
594
+ const babelLoader = environment.loaders.get('babel')
595
+ environment.loaders.insert(
596
+ 'coffee',
597
+ {
598
+ test: /\.coffee(\.erb)?$/,
599
+ use: babelLoader.use.concat(['coffee-loader'])
600
+ },
601
+ { before: 'json' }
602
+ )
603
+ ```
604
+
605
+ - Expose `resolve.modules` paths like loaders and plugins
606
+
607
+ ```js
608
+ environment.resolvedModules.append('vendor', 'vendor')
609
+ ```
610
+
611
+ - Enable sourcemaps in `style` and `css` loader
612
+
613
+ - Separate `css` and `sass` loader for easier configuration. `style` loader is now
614
+ `css` loader, which resolves `.css` files and `sass` loader resolves `.scss` and `.sass`
615
+ files.
616
+
617
+ ```js
618
+ // Enable css modules with sass loader
619
+ const sassLoader = environment.loaders.get('sass')
620
+ const cssLoader = sassLoader.use.find(loader => loader.loader === 'css-loader')
621
+
622
+ cssLoader.options = Object.assign({}, cssLoader.options, {
623
+ modules: true,
624
+ localIdentName: '[path][name]__[local]--[hash:base64:5]'
625
+ })
626
+ ```
627
+
628
+ - Expose rest of configurable dev server options from webpacker.yml
629
+
630
+ ```yml
631
+ quiet: false
632
+ headers:
633
+ 'Access-Control-Allow-Origin': '*'
634
+ watch_options:
635
+ ignored: /node_modules/
636
+ ```
637
+
638
+ - `pretty` option to disable/enable color and progress output when running dev server
639
+
640
+ ```yml
641
+ dev_server:
642
+ pretty: false
643
+ ```
644
+
645
+ - Enforce deterministic loader order in desc order, starts processing from top to bottom
646
+
647
+ - Enforce the entire path of all required modules match the exact case of the actual path on disk using [case sensitive paths plugin](https://github.com/Urthen/case-sensitive-paths-webpack-plugin).
648
+
649
+ - Add url loader to process and embed smaller static files
650
+
651
+ ### Removed
652
+
653
+ - resolve url loader [#1042](https://github.com/rails/webpacker/issues/1042)
654
+
655
+ ### Added (Gem)
656
+
657
+ - Allow skipping webpacker compile using an env variable
658
+
659
+ ```bash
660
+ WEBPACKER_PRECOMPILE=no|false|n|f
661
+ WEBPACKER_PRECOMPILE=false bundle exec rails assets:precompile
662
+ ```
663
+
664
+ - Use `WEBPACKER_ASSET_HOST` instead of `ASSET_HOST` for CDN
665
+
666
+ - Alias `webpacker:compile` task to `assets:precompile` if is not defined so it works
667
+ without sprockets
668
+
669
+ ## [3.0.2] - 2017-10-04
670
+
671
+ ### Added
672
+
673
+ - Allow dev server connect timeout (in seconds) to be configurable, default: 0.01
674
+
675
+ ```rb
676
+ # Change to 1s
677
+ Webpacker.dev_server.connect_timeout = 1
678
+ ```
679
+
680
+ - Restrict the source maps generated in production [#770](https://github.com/rails/webpacker/pull/770)
681
+
682
+ - Binstubs [#833](https://github.com/rails/webpacker/pull/833)
683
+
684
+ - Allow dev server settings to be overridden by env variables [#843](https://github.com/rails/webpacker/pull/843)
685
+
686
+ - A new `lookup` method to manifest to perform lookup without raise and return `nil`
687
+
688
+ ```rb
689
+ Webpacker.manifest.lookup('foo.js')
690
+ # => nil
691
+ Webpacker.manifest.lookup!('foo.js')
692
+ # => raises Webpacker::Manifest::MissingEntryError
693
+ ```
694
+
695
+ - Catch all exceptions in `DevServer.running?` and return false [#878](https://github.com/rails/webpacker/pull/878)
696
+
697
+ ### Removed
698
+
699
+ - Inline CLI args for dev server binstub, use env variables instead
700
+
701
+ - Coffeescript as core dependency. You have to manually add coffeescript now, if you are using
702
+ it in your app.
703
+
704
+ ```bash
705
+ yarn add coffeescript@1.12.7
706
+
707
+ # OR coffeescript 2.0
708
+ yarn add coffeescript
709
+ ```
710
+
711
+ ## [3.0.1] - 2017-09-01
712
+
713
+ ### Fixed
714
+
715
+ - Missing `node_modules/.bin/*` files by bumping minimum Yarn version to 0.25.2 [#727](https://github.com/rails/webpacker/pull/727)
716
+
717
+ - `webpacker:compile` task so that fails properly when webpack compilation fails [#728](https://github.com/rails/webpacker/pull/728)
718
+
719
+ - Rack dev server proxy middleware when served under another proxy (example: pow), which uses `HTTP_X_FORWARDED_HOST` header resulting in `404` for webpacker assets
720
+
721
+ - Make sure tagged logger works with rails < 5 [#716](https://github.com/rails/webpacker/pull/716)
722
+
723
+ ### Added
724
+
725
+ - Allow webpack dev server listen host/ip to be configurable using additional `--listen-host` option
726
+
727
+ ```bash
728
+ ./bin/webpack-dev-server --listen-host 0.0.0.0 --host localhost
729
+ ```
730
+
731
+ ### Removed
732
+
733
+ - `watchContentBase` from devServer config so it doesn't unncessarily trigger
734
+ live reload when manifest changes. If you have applied this workaround from [#724](https://github.com/rails/webpacker/issues/724), please revert the change from `config/webpack/development.js` since this is now fixed.
735
+
736
+ ## [3.0.0] - 2017-08-30
737
+
738
+ ### Added
739
+
740
+ - `resolved_paths` option to allow adding additional paths webpack should lookup when resolving modules
741
+
742
+ ```yml
743
+ # config/webpacker.yml
744
+ # Additional paths webpack should lookup modules
745
+ resolved_paths: [] # empty by default
746
+ ```
747
+
748
+ - `Webpacker::Compiler.fresh?` and `Webpacker::Compiler.stale?` answer the question of whether compilation is needed.
749
+ The old `Webpacker::Compiler.compile?` predicate is deprecated.
750
+
751
+ - Dev server config class that exposes config options through singleton.
752
+
753
+ ```rb
754
+ Webpacker.dev_server.running?
755
+ ```
756
+
757
+ - Rack middleware proxies webpacker requests to dev server so we can always serve from same-origin and the lookup works out of the box - no more paths prefixing
758
+
759
+ - `env` attribute on `Webpacker::Compiler` allows setting custom environment variables that the compilation is being run with
760
+
761
+ ```rb
762
+ Webpacker::Compiler.env['FRONTEND_API_KEY'] = 'your_secret_key'
763
+ ```
764
+
765
+ ### Breaking changes
766
+
767
+ **Note:** requires running `bundle exec rails webpacker:install`
768
+
769
+ `config/webpack/**/*.js`:
770
+
771
+ - The majority of this config moved to the [@rails/webpacker npm package](https://www.npmjs.com/package/@rails/webpacker). `webpacker:install` only creates `config/webpack/{environment,development,test,production}.js` now so if you're upgrading from a previous version you can remove all other files.
772
+
773
+ `webpacker.yml`:
774
+
775
+ - Move dev-server config options under defaults so it's transparently available in all environments
776
+
777
+ - Add new `HMR` option for hot-module-replacement
778
+
779
+ - Add HTTPS
780
+
781
+ ### Removed
782
+
783
+ - Host info from manifest.json, now looks like this:
784
+
785
+ ```json
786
+ {
787
+ "hello_react.js": "/packs/hello_react.js"
788
+ }
789
+ ```
790
+
791
+ ### Fixed
792
+
793
+ - Update `webpack-dev-server.tt` to respect RAILS_ENV and NODE_ENV values [#502](https://github.com/rails/webpacker/issues/502)
794
+ - Use `0.0.0.0` as default listen address for `webpack-dev-server`
795
+ - Serve assets using `localhost` from dev server - [#424](https://github.com/rails/webpacker/issues/424)
796
+
797
+ ```yml
798
+ dev_server:
799
+ host: localhost
800
+ ```
801
+
802
+ - On Windows, `ruby bin/webpacker` and `ruby bin/webpacker-dev-server` will now bypass yarn, and execute via `node_modules/.bin` directly - [#584](https://github.com/rails/webpacker/pull/584)
803
+
804
+ ### Breaking changes
805
+
806
+ - Add `compile` and `cache_path` options to `config/webpacker.yml` for configuring lazy compilation of packs when a file under tracked paths is changed [#503](https://github.com/rails/webpacker/pull/503). To enable expected behavior, update `config/webpacker.yml`:
807
+
808
+ ```yaml
809
+ default: &default
810
+ cache_path: tmp/cache/webpacker
811
+ test:
812
+ compile: true
813
+
814
+ development:
815
+ compile: true
816
+
817
+ production:
818
+ compile: false
819
+ ```
820
+
821
+ - Make test compilation cacheable and configurable so that the lazy compilation
822
+ only triggers if files are changed under tracked paths.
823
+ Following paths are watched by default -
824
+
825
+ ```rb
826
+ ["app/javascript/**/*", "yarn.lock", "package.json", "config/webpack/**/*"]
827
+ ```
828
+
829
+ To add more paths:
830
+
831
+ ```rb
832
+ # config/initializers/webpacker.rb or config/application.rb
833
+ Webpacker::Compiler.watched_paths << 'bower_components'
834
+ ```
835
+
836
+ ## [2.0] - 2017-05-24
837
+
838
+ ### Fixed
839
+
840
+ - Update `.babelrc` to fix compilation issues - [#306](https://github.com/rails/webpacker/issues/306)
841
+
842
+ - Duplicated asset hosts - [#320](https://github.com/rails/webpacker/issues/320), [#397](https://github.com/rails/webpacker/pull/397)
843
+
844
+ - Missing asset host when defined as a `Proc` or on `ActionController::Base.asset_host` directly - [#397](https://github.com/rails/webpacker/pull/397)
845
+
846
+ - Incorrect asset host when running `webpacker:compile` or `bin/webpack` in development mode - [#397](https://github.com/rails/webpacker/pull/397)
847
+
848
+ - Update `webpacker:compile` task to use `stdout` and `stderr` for better logging - [#395](https://github.com/rails/webpacker/issues/395)
849
+
850
+ - ARGV support for `webpack-dev-server` - [#286](https://github.com/rails/webpacker/issues/286)
851
+
852
+ ### Added
853
+
854
+ - [Elm](http://elm-lang.org) support. You can now add Elm support via the following methods:
855
+
856
+ - New app: `rails new <app> --webpack=elm`
857
+ - Within an existing app: `rails webpacker:install:elm`
858
+
859
+ - Support for custom `public_output_path` paths independent of `source_entry_path` in `config/webpacker.yml`. `output` is also now relative to `public/`. - [#397](https://github.com/rails/webpacker/pull/397)
860
+
861
+ Before (compile to `public/packs`):
862
+
863
+ ```yaml
864
+ source_entry_path: packs
865
+ public_output_path: packs
866
+ ```
867
+
868
+ After (compile to `public/sweet/js`):
869
+
870
+ ```yaml
871
+ source_entry_path: packs
872
+ public_output_path: sweet/js
873
+ ```
874
+
875
+ - `https` option to use `https` mode, particularly on platforms like - https://community.c9.io/t/running-a-rails-app/1615 or locally - [#176](https://github.com/rails/webpacker/issues/176)
876
+
877
+ - [Babel] Dynamic import() and Class Fields and Static Properties babel plugin to `.babelrc`
878
+
879
+ ```json
880
+ {
881
+ "presets": [
882
+ [
883
+ "env",
884
+ {
885
+ "modules": false,
886
+ "targets": {
887
+ "browsers": "> 1%",
888
+ "uglify": true
889
+ },
890
+ "useBuiltIns": true
891
+ }
892
+ ]
893
+ ],
894
+
895
+ "plugins": [
896
+ "syntax-dynamic-import",
897
+ "transform-class-properties",
898
+ { "spec": true }
899
+ ]
900
+ }
901
+ ```
902
+
903
+ - Source-map support for production bundle
904
+
905
+ #### Breaking Change
906
+
907
+ - Consolidate and flatten `paths.yml` and `development.server.yml` config into one file - `config/webpacker.yml` - [#403](https://github.com/rails/webpacker/pull/403). This is a breaking change and requires you to re-install webpacker and cleanup old configuration files.
908
+
909
+ ```bash
910
+ bundle update webpacker
911
+ bundle exec rails webpacker:install
912
+
913
+ # Remove old/unused configuration files
914
+ rm config/webpack/paths.yml
915
+ rm config/webpack/development.server.yml
916
+ rm config/webpack/development.server.js
917
+ ```
918
+
919
+ **Warning**: For now you also have to add a pattern in `.gitignore` by hand.
920
+
921
+ ```diff
922
+ /public/packs
923
+ +/public/packs-test
924
+ /node_modules
925
+ ```
926
+
927
+ ## [1.2] - 2017-04-27
928
+
929
+ Some of the changes made requires you to run below commands to install new changes.
930
+
931
+ ```
932
+ bundle update webpacker
933
+ bundle exec rails webpacker:install
934
+ ```
935
+
936
+ ### Fixed
937
+
938
+ - Support Spring - [#205](https://github.com/rails/webpacker/issues/205)
939
+
940
+ ```ruby
941
+ Spring.after_fork { Webpacker.bootstrap } if defined?(Spring)
942
+ ```
943
+
944
+ - Check node version and yarn before installing webpacker - [#217](https://github.com/rails/webpacker/issues/217)
945
+
946
+ - Include webpacker helper to views - [#172](https://github.com/rails/webpacker/issues/172)
947
+
948
+ - Webpacker installer on windows - [#245](https://github.com/rails/webpacker/issues/245)
949
+
950
+ - Yarn duplication - [#278](https://github.com/rails/webpacker/issues/278)
951
+
952
+ - Add back Spring for `rails-erb-loader` - [#216](https://github.com/rails/webpacker/issues/216)
953
+
954
+ - Move babel presets and plugins to .babelrc - [#202](https://github.com/rails/webpacker/issues/202)
955
+
956
+ ### Added
957
+
958
+ - A changelog - [#211](https://github.com/rails/webpacker/issues/211)
959
+ - Minimize CSS assets - [#218](https://github.com/rails/webpacker/issues/218)
960
+ - Pack namespacing support - [#201](https://github.com/rails/webpacker/pull/201)
961
+
962
+ For example:
963
+
964
+ ```
965
+ app/javascript/packs/admin/hello_vue.js
966
+ app/javascript/packs/admin/hello.vue
967
+ app/javascript/packs/hello_vue.js
968
+ app/javascript/packs/hello.vue
969
+ ```
970
+
971
+ - Add tree-shaking support - [#250](https://github.com/rails/webpacker/pull/250)
972
+ - Add initial test case by @kimquy [#259](https://github.com/rails/webpacker/pull/259)
973
+ - Compile assets before test:controllers and test:system
974
+
975
+ ### Removed
976
+
977
+ - Webpack watcher - [#295](https://github.com/rails/webpacker/pull/295)
978
+
979
+ ## [1.1] - 2017-03-24
980
+
981
+ This release requires you to run below commands to install new features.
982
+
983
+ ```
984
+ bundle update webpacker
985
+ bundle exec rails webpacker:install
986
+
987
+ # if installed react, vue or angular
988
+ bundle exec rails webpacker:install:[react, angular, vue]
989
+ ```
990
+
991
+ ### Added (breaking changes)
992
+
993
+ - Static assets support - [#153](https://github.com/rails/webpacker/pull/153)
994
+ - Advanced webpack configuration - [#153](https://github.com/rails/webpacker/pull/153)
995
+
996
+ ### Removed
997
+
998
+ ```rb
999
+ config.x.webpacker[:digesting] = true
1000
+ ```