webpacker 5.4.2 → 6.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +1 -1
  3. data/.github/workflows/ruby.yml +12 -0
  4. data/.gitignore +2 -0
  5. data/.node-version +1 -1
  6. data/.rubocop.yml +3 -108
  7. data/6_0_upgrade.md +43 -0
  8. data/CHANGELOG.md +19 -18
  9. data/CONTRIBUTING.md +1 -1
  10. data/Gemfile.lock +91 -94
  11. data/README.md +220 -99
  12. data/gemfiles/Gemfile-rails-edge +1 -1
  13. data/lib/install/config/webpack/base.js +3 -0
  14. data/lib/install/config/webpack/development.js +2 -2
  15. data/lib/install/config/webpack/production.js +2 -2
  16. data/lib/install/config/webpack/test.js +2 -2
  17. data/lib/install/config/webpacker.yml +8 -37
  18. data/lib/install/javascript/packs/application.css +9 -0
  19. data/lib/install/javascript/packs/application.js +3 -1
  20. data/lib/install/template.rb +32 -26
  21. data/lib/tasks/webpacker/binstubs.rake +6 -4
  22. data/lib/tasks/webpacker/check_binstubs.rake +4 -4
  23. data/lib/tasks/webpacker/check_yarn.rake +1 -1
  24. data/lib/tasks/webpacker/compile.rake +4 -2
  25. data/lib/tasks/webpacker/info.rake +12 -10
  26. data/lib/tasks/webpacker/install.rake +6 -4
  27. data/lib/tasks/webpacker/verify_install.rake +2 -1
  28. data/lib/tasks/webpacker/yarn_install.rake +9 -7
  29. data/lib/tasks/webpacker.rake +2 -11
  30. data/lib/webpacker/compiler.rb +15 -8
  31. data/lib/webpacker/configuration.rb +10 -45
  32. data/lib/webpacker/dev_server_runner.rb +21 -2
  33. data/lib/webpacker/env.rb +1 -5
  34. data/lib/webpacker/helper.rb +22 -32
  35. data/lib/webpacker/manifest.rb +1 -1
  36. data/lib/webpacker/version.rb +1 -1
  37. data/lib/webpacker/webpack_runner.rb +5 -0
  38. data/package/__tests__/config.js +5 -37
  39. data/package/__tests__/development.js +9 -11
  40. data/package/__tests__/env.js +12 -4
  41. data/package/__tests__/production.js +6 -6
  42. data/package/__tests__/staging.js +7 -6
  43. data/package/__tests__/test.js +4 -5
  44. data/package/babel/preset.js +55 -0
  45. data/package/config.js +3 -11
  46. data/package/env.js +8 -2
  47. data/package/environments/__tests__/base.js +15 -47
  48. data/package/environments/base.js +62 -125
  49. data/package/environments/development.js +45 -44
  50. data/package/environments/production.js +63 -68
  51. data/package/environments/test.js +2 -2
  52. data/package/index.js +13 -8
  53. data/package/rules/babel.js +9 -7
  54. data/package/rules/coffee.js +6 -0
  55. data/package/rules/erb.js +15 -0
  56. data/package/rules/file.js +19 -19
  57. data/package/rules/index.js +15 -18
  58. data/package/rules/less.js +22 -0
  59. data/package/rules/sass.js +10 -10
  60. data/package/rules/svg.js +20 -0
  61. data/package/utils/get_style_rule.js +26 -36
  62. data/package/utils/helpers.js +26 -35
  63. data/package.json +29 -45
  64. data/test/compiler_test.rb +0 -12
  65. data/test/configuration_test.rb +1 -32
  66. data/test/dev_server_runner_test.rb +24 -5
  67. data/test/engine_rake_tasks_test.rb +39 -0
  68. data/test/helper_test.rb +24 -30
  69. data/test/mounted_app/Rakefile +4 -0
  70. data/test/mounted_app/test/dummy/Rakefile +3 -0
  71. data/test/mounted_app/test/dummy/bin/rails +3 -0
  72. data/test/mounted_app/test/dummy/bin/rake +3 -0
  73. data/test/mounted_app/test/dummy/config/application.rb +10 -0
  74. data/test/mounted_app/test/dummy/config/environment.rb +3 -0
  75. data/test/mounted_app/test/dummy/config/webpacker.yml +75 -0
  76. data/test/mounted_app/test/dummy/config.ru +5 -0
  77. data/test/mounted_app/test/dummy/package.json +7 -0
  78. data/test/rake_tasks_test.rb +1 -10
  79. data/test/test_app/config/webpacker.yml +1 -25
  80. data/test/test_app/config/webpacker_public_root.yml +0 -1
  81. data/test/test_app/public/packs/manifest.json +17 -13
  82. data/test/test_app/some.config.js +0 -0
  83. data/test/webpack_runner_test.rb +9 -3
  84. data/yarn.lock +2505 -4943
  85. metadata +37 -83
  86. data/.travis.yml +0 -43
  87. data/docs/assets.md +0 -119
  88. data/docs/cloud9.md +0 -310
  89. data/docs/css.md +0 -308
  90. data/docs/deployment.md +0 -130
  91. data/docs/docker.md +0 -68
  92. data/docs/engines.md +0 -213
  93. data/docs/env.md +0 -63
  94. data/docs/es6.md +0 -72
  95. data/docs/folder-structure.md +0 -66
  96. data/docs/integrations.md +0 -220
  97. data/docs/misc.md +0 -23
  98. data/docs/props.md +0 -223
  99. data/docs/target.md +0 -22
  100. data/docs/testing.md +0 -136
  101. data/docs/troubleshooting.md +0 -158
  102. data/docs/typescript.md +0 -190
  103. data/docs/v4-upgrade.md +0 -142
  104. data/docs/webpack-dev-server.md +0 -92
  105. data/docs/webpack.md +0 -364
  106. data/docs/yarn.md +0 -23
  107. data/lib/install/angular.rb +0 -23
  108. data/lib/install/coffee.rb +0 -25
  109. data/lib/install/config/.browserslistrc +0 -1
  110. data/lib/install/config/babel.config.js +0 -82
  111. data/lib/install/config/postcss.config.js +0 -12
  112. data/lib/install/config/webpack/environment.js +0 -3
  113. data/lib/install/elm.rb +0 -39
  114. data/lib/install/erb.rb +0 -25
  115. data/lib/install/examples/angular/hello_angular/app/app.component.ts +0 -9
  116. data/lib/install/examples/angular/hello_angular/app/app.module.ts +0 -16
  117. data/lib/install/examples/angular/hello_angular/index.ts +0 -8
  118. data/lib/install/examples/angular/hello_angular/polyfills.ts +0 -73
  119. data/lib/install/examples/angular/hello_angular.js +0 -7
  120. data/lib/install/examples/coffee/hello_coffee.coffee +0 -4
  121. data/lib/install/examples/elm/Main.elm +0 -55
  122. data/lib/install/examples/elm/hello_elm.js +0 -16
  123. data/lib/install/examples/erb/hello_erb.js.erb +0 -6
  124. data/lib/install/examples/react/babel.config.js +0 -99
  125. data/lib/install/examples/react/hello_react.jsx +0 -26
  126. data/lib/install/examples/react/tsconfig.json +0 -21
  127. data/lib/install/examples/stimulus/application.js +0 -1
  128. data/lib/install/examples/stimulus/controllers/hello_controller.js +0 -18
  129. data/lib/install/examples/stimulus/controllers/index.js +0 -9
  130. data/lib/install/examples/svelte/app.svelte +0 -11
  131. data/lib/install/examples/svelte/hello_svelte.js +0 -20
  132. data/lib/install/examples/typescript/hello_typescript.ts +0 -4
  133. data/lib/install/examples/typescript/tsconfig.json +0 -24
  134. data/lib/install/examples/vue/app.vue +0 -22
  135. data/lib/install/examples/vue/hello_vue.js +0 -72
  136. data/lib/install/loaders/coffee.js +0 -6
  137. data/lib/install/loaders/elm.js +0 -25
  138. data/lib/install/loaders/erb.js +0 -11
  139. data/lib/install/loaders/svelte.js +0 -9
  140. data/lib/install/loaders/vue.js +0 -6
  141. data/lib/install/react.rb +0 -18
  142. data/lib/install/stimulus.rb +0 -12
  143. data/lib/install/svelte.rb +0 -29
  144. data/lib/install/typescript.rb +0 -39
  145. data/lib/install/vue.rb +0 -49
  146. data/lib/tasks/installers.rake +0 -42
  147. data/package/config_types/__tests__/config_list.js +0 -118
  148. data/package/config_types/__tests__/config_object.js +0 -43
  149. data/package/config_types/config_list.js +0 -75
  150. data/package/config_types/config_object.js +0 -55
  151. data/package/config_types/index.js +0 -7
  152. data/package/rules/module.css.js +0 -3
  153. data/package/rules/module.sass.js +0 -8
  154. data/package/rules/node_modules.js +0 -22
  155. data/package/utils/__tests__/deep_assign.js +0 -32
  156. data/package/utils/__tests__/deep_merge.js +0 -10
  157. data/package/utils/__tests__/get_style_rule.js +0 -65
  158. data/package/utils/__tests__/objectify.js +0 -9
  159. data/package/utils/deep_assign.js +0 -22
  160. data/package/utils/deep_merge.js +0 -22
  161. data/package/utils/objectify.js +0 -3
data/README.md CHANGED
@@ -1,11 +1,15 @@
1
1
  # Webpacker
2
2
 
3
- [![Build Status](https://travis-ci.org/rails/webpacker.svg?branch=master)](https://travis-ci.org/rails/webpacker)
3
+ [![Ruby specs](https://github.com/rails/webpacker/workflows/Ruby%20specs/badge.svg)](https://github.com/rails/webpacker/actions)
4
+ [![Jest specs](https://github.com/rails/webpacker/workflows/Jest%20specs/badge.svg)](https://github.com/rails/webpacker/actions)
5
+ [![Rubocop](https://github.com/rails/webpacker/workflows/Rubocop/badge.svg)](https://github.com/rails/webpacker/actions)
6
+ [![JS lint](https://github.com/rails/webpacker/workflows/JS%20lint/badge.svg)](https://github.com/rails/webpacker/actions)
7
+
4
8
  [![node.js](https://img.shields.io/badge/node-%3E%3D%2010.17.0-brightgreen.svg)](https://www.npmjs.com/package/@rails/webpacker)
5
9
  [![Gem](https://img.shields.io/gem/v/webpacker.svg)](https://rubygems.org/gems/webpacker)
6
10
 
7
11
  Webpacker makes it easy to use the JavaScript pre-processor and bundler
8
- [webpack 4.x.x+](https://webpack.js.org/)
12
+ [webpack 5.x.x+](https://webpack.js.org/)
9
13
  to manage application-like JavaScript in Rails. It coexists with the asset pipeline,
10
14
  as the primary purpose for webpack is app-like JavaScript, not images, CSS, or
11
15
  even JavaScript Sprinkles (that all continues to live in app/assets).
@@ -13,7 +17,7 @@ even JavaScript Sprinkles (that all continues to live in app/assets).
13
17
  However, it is possible to use Webpacker for CSS, images and fonts assets as well,
14
18
  in which case you may not even need the asset pipeline. This is mostly relevant when exclusively using component-based JavaScript frameworks.
15
19
 
16
- **NOTE:** The master branch now hosts the code for v5.x.x. Please refer to [4-x-stable](https://github.com/rails/webpacker/tree/4-x-stable) branch for 4.x documentation.
20
+ **NOTE:** The master branch now hosts the code for v6.x.x. Please refer to [5-x-stable](https://github.com/rails/webpacker/tree/5-x-stable) branch for 5.x documentation.
17
21
 
18
22
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
19
23
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
@@ -28,16 +32,6 @@ in which case you may not even need the asset pipeline. This is mostly relevant
28
32
  - [Webpack Configuration](#webpack-configuration)
29
33
  - [Custom Rails environments](#custom-rails-environments)
30
34
  - [Upgrading](#upgrading)
31
- - [Integrations](#integrations)
32
- - [React](./docs/integrations.md#react)
33
- - [Angular with TypeScript](./docs/integrations.md#angular-with-typescript)
34
- - [Vue](./docs/integrations.md#vue)
35
- - [Elm](./docs/integrations.md#elm)
36
- - [Stimulus](./docs/integrations.md#stimulus)
37
- - [Svelte](./docs/integrations.md#svelte)
38
- - [Typescript](./docs/typescript.md)
39
- - [CoffeeScript](./docs/integrations.md#coffeescript)
40
- - [Erb](./docs/integrations.md#erb)
41
35
  - [Paths](#paths)
42
36
  - [Resolved](#resolved)
43
37
  - [Watched](#watched)
@@ -52,23 +46,28 @@ in which case you may not even need the asset pipeline. This is mostly relevant
52
46
 
53
47
  - Ruby 2.4+
54
48
  - Rails 5.2+
55
- - Node.js 10.17.0+
49
+ - Node.js 10.22.1+ || 12+ || 14+
56
50
  - Yarn 1.x+
57
51
 
58
52
  ## Features
59
53
 
60
- - [webpack 4.x.x](https://webpack.js.org/)
54
+ - [webpack 5.x.x](https://webpack.js.org/)
61
55
  - ES6 with [babel](https://babeljs.io/)
62
56
  - Automatic code splitting using multiple entry points
63
- - Stylesheets - Sass and CSS
64
- - Images and fonts
65
- - PostCSS - Auto-Prefixer
66
57
  - Asset compression, source-maps, and minification
67
58
  - CDN support
68
- - React, Angular, Elm and Vue support out-of-the-box
69
59
  - Rails view helpers
70
60
  - Extensible and configurable
71
61
 
62
+ ### Optional support\*
63
+
64
+ _requires extra packages to be installed_
65
+
66
+ - Stylesheets - SASS, LESS and CSS, PostCSS
67
+ - Coffeescript
68
+ - Typescript
69
+ - React
70
+
72
71
  ## Installation
73
72
 
74
73
  You can either add Webpacker during setup of a new Rails 5.1+ application
@@ -83,12 +82,11 @@ Or add it to your `Gemfile`:
83
82
 
84
83
  ```ruby
85
84
  # Gemfile
86
- gem 'webpacker', '~> 5.x'
85
+ gem 'webpacker', '~> 6.x'
87
86
 
88
87
  # OR if you prefer to use master
89
88
  gem 'webpacker', git: 'https://github.com/rails/webpacker.git'
90
89
  yarn add https://github.com/rails/webpacker.git
91
- yarn add core-js regenerator-runtime
92
90
  ```
93
91
 
94
92
  Finally, run the following to install Webpacker:
@@ -131,19 +129,11 @@ app/javascript:
131
129
  └── logo.svg
132
130
  ```
133
131
 
134
- In `/packs/application.js`, include this at the top of the file:
135
-
136
- ```js
137
- import 'core-js/stable'
138
- import 'regenerator-runtime/runtime'
139
- ```
140
-
141
- You can then link the JavaScript pack in Rails views using the `javascript_pack_tag` helper.
142
- If you have styles imported in your pack file, you can link them by using `stylesheet_pack_tag`:
132
+ You can then link the JavaScript pack in Rails views using the `javascript_packs_with_chunks_tag` helper. If you have styles imported in your pack file, you can link them by using `stylesheet_packs_with_chunks_tag`:
143
133
 
144
134
  ```erb
145
- <%= javascript_pack_tag 'application' %>
146
- <%= stylesheet_pack_tag 'application' %>
135
+ <%= javascript_packs_with_chunks_tag 'application' %>
136
+ <%= stylesheet_packs_with_chunks_tag 'application' %>
147
137
  ```
148
138
 
149
139
  If you want to link a static asset for `<link rel="prefetch">` or `<img />` tag, you
@@ -154,31 +144,6 @@ can use the `asset_pack_path` helper:
154
144
  <img src="<%= asset_pack_path 'images/logo.svg' %>" />
155
145
  ```
156
146
 
157
- If you are using new webpack 4 split chunks API, then consider using `javascript_packs_with_chunks_tag` helper, which creates html
158
- tags for a pack and all the dependent chunks.
159
-
160
- ```erb
161
- <%= javascript_packs_with_chunks_tag 'calendar', 'map', 'data-turbolinks-track': 'reload' %>
162
-
163
- <script src="/packs/vendor-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
164
- <script src="/packs/calendar~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
165
- <script src="/packs/calendar-1016838bab065ae1e314.js" data-turbolinks-track="reload"></script>
166
- <script src="/packs/map~runtime-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
167
- <script src="/packs/map-16838bab065ae1e314.js" data-turbolinks-track="reload"></script>
168
- ```
169
-
170
- **Important:** Pass all your pack names when using `javascript_packs_with_chunks_tag`
171
- helper otherwise you will get duplicated chunks on the page.
172
-
173
- ```erb
174
- <%# DO %>
175
- <%= javascript_packs_with_chunks_tag 'calendar', 'map' %>
176
-
177
- <%# DON'T %>
178
- <%= javascript_packs_with_chunks_tag 'calendar' %>
179
- <%= javascript_packs_with_chunks_tag 'map' %>
180
- ```
181
-
182
147
  **Note:** In order for your styles or static assets files to be available in your view,
183
148
  you would need to link them in your "pack" or entry file.
184
149
 
@@ -244,7 +209,201 @@ WEBPACKER_DEV_SERVER_HOST=0.0.0.0 ./bin/webpack-dev-server
244
209
 
245
210
  ### Webpack Configuration
246
211
 
247
- See [docs/webpack](docs/webpack.md) for modifying webpack configuration and loaders.
212
+ Webpacker gives you a default set of configuration files for test, development and
213
+ production environments in `config/webpack/*.js`. You can configure each individual
214
+ environment in their respective files or configure them all in the base
215
+ `config/webpack/environment.js` file.
216
+
217
+ By default, you don't need to make any changes to `config/webpack/*.js`
218
+ files since it's all standard production-ready configuration. However,
219
+ if you do need to customize or add a new loader, this is where you would go.
220
+
221
+ Here is how you can modify webpack configuration:
222
+
223
+ You might add separate files to keep your code more organized.
224
+
225
+ ```js
226
+ // config/webpack/custom.js
227
+ module.exports = {
228
+ resolve: {
229
+ alias: {
230
+ jquery: 'jquery/src/jquery',
231
+ vue: 'vue/dist/vue.js',
232
+ React: 'react',
233
+ ReactDOM: 'react-dom',
234
+ vue_resource: 'vue-resource/dist/vue-resource'
235
+ }
236
+ }
237
+ }
238
+ ```
239
+
240
+ Then `require` this file in your `config/webpack/base.js`:
241
+
242
+ ```js
243
+ // config/webpack/base.js
244
+ const { webpackConfig, merge } = require('@rails/webpacker')
245
+ const customConfig = require('./custom')
246
+
247
+ module.exports = merge(webpackConfig, customConfig)
248
+ ```
249
+
250
+ If you need access to configs within Webpacker's configuration,
251
+ you can import them like so:
252
+
253
+ ```js
254
+ // config/webpack/base.js
255
+ const { webpackConfig } = require('@rails/webpacker')
256
+
257
+ console.log(webpackConfig.output_path)
258
+ console.log(webpackConfig.source_path)
259
+ ```
260
+
261
+ ### Integrations
262
+
263
+ Webpacker out of the box supports JS and static assets (fonts, images etc.)
264
+ compilation. To enable support for Coffeescript or Typescript install
265
+ relevant packages,
266
+
267
+ **Coffeescript**
268
+
269
+ ```
270
+ yarn add coffeescript coffee-loader
271
+ ```
272
+
273
+ **Typescript**
274
+
275
+ ```
276
+ yarn add typescript @babel/preset-typescript
277
+ ```
278
+
279
+ Add tsconfig.json
280
+
281
+ ```json
282
+ {
283
+ "compilerOptions": {
284
+ "declaration": false,
285
+ "emitDecoratorMetadata": true,
286
+ "experimentalDecorators": true,
287
+ "lib": ["es6", "dom"],
288
+ "module": "es6",
289
+ "moduleResolution": "node",
290
+ "baseUrl": ".",
291
+ "paths": {
292
+ "*": ["node_modules/*", "app/javascript/*"]
293
+ },
294
+ "sourceMap": true,
295
+ "target": "es5",
296
+ "noEmit": true
297
+ },
298
+ "exclude": ["**/*.spec.ts", "node_modules", "vendor", "public"],
299
+ "compileOnSave": false
300
+ }
301
+ ```
302
+
303
+ #### CSS
304
+
305
+ To enable CSS support in your application, add following packages,
306
+
307
+ ```
308
+ yarn add css-loader mini-css-extract-plugin css-minimizer-webpack-plugin
309
+ ```
310
+
311
+ optionally, add css extension to webpack config for easy resolution
312
+
313
+ ```js
314
+ // config/webpack/base.js
315
+ const { webpackConfig, merge } = require('@rails/webpacker')
316
+ const customConfig = {
317
+ resolve: {
318
+ extensions: ['.css']
319
+ }
320
+ }
321
+
322
+ module.exports = merge(webpackConfig, customConfig)
323
+ ```
324
+
325
+ To enable postcss, sass or less support, add css support first and
326
+ then add the relevant pre-processors:
327
+
328
+ #### Postcss
329
+
330
+ ```
331
+ yarn add postcss-loader
332
+ ```
333
+
334
+ #### Sass
335
+
336
+ ```
337
+ yarn add sass-loader
338
+ ```
339
+
340
+ #### Less
341
+
342
+ ```
343
+ yarn add less-loader
344
+ ```
345
+
346
+ #### React
347
+
348
+ React is supported and you just need to add relevant packages,
349
+
350
+ ```
351
+ yarn add react react-dom @babel/preset-react
352
+ ```
353
+
354
+ if you are using typescript, update your `tsconfig.json`
355
+
356
+ ```json
357
+ {
358
+ "compilerOptions": {
359
+ "declaration": false,
360
+ "emitDecoratorMetadata": true,
361
+ "experimentalDecorators": true,
362
+ "lib": ["es6", "dom"],
363
+ "module": "es6",
364
+ "moduleResolution": "node",
365
+ "sourceMap": true,
366
+ "target": "es5",
367
+ "jsx": "react",
368
+ "noEmit": true
369
+ },
370
+ "exclude": ["**/*.spec.ts", "node_modules", "vendor", "public"],
371
+ "compileOnSave": false
372
+ }
373
+ ```
374
+
375
+ #### Other frameworks
376
+
377
+ Please follow webpack integration guide for relevant framework or library,
378
+
379
+ 1. Svelte - https://github.com/sveltejs/svelte-loader#install
380
+ 2. Angular - https://v2.angular.io/docs/ts/latest/guide/webpack.html#!#configure-webpack
381
+ 3. Vue - https://vue-loader.vuejs.org/guide/
382
+
383
+ For example to add Vue support,
384
+
385
+ ```js
386
+ // config/webpack/rules/vue.js
387
+ const VueLoaderPlugin = require('vue-loader/lib/plugin')
388
+
389
+ module.exports = {
390
+ module: {
391
+ rules: [
392
+ {
393
+ test: /\.vue$/,
394
+ loader: 'vue-loader'
395
+ }
396
+ ]
397
+ },
398
+ plugins: [new VueLoaderPlugin()]
399
+ }
400
+
401
+ // config/webpack/base.js
402
+ const { webpackConfig, merge } = require('@rails/webpacker')
403
+ const vueConfig = require('./rules/vue')
404
+
405
+ module.exports = merge(webpackConfig, vueConfig)
406
+ ```
248
407
 
249
408
  ### Custom Rails environments
250
409
 
@@ -301,7 +460,7 @@ You can run following commands to upgrade Webpacker to the latest stable version
301
460
 
302
461
  ```bash
303
462
  bundle update webpacker
304
- rails webpacker:binstubs
463
+ rails webpacker:install
305
464
  yarn upgrade @rails/webpacker --latest
306
465
  yarn upgrade webpack-dev-server --latest
307
466
 
@@ -309,24 +468,6 @@ yarn upgrade webpack-dev-server --latest
309
468
  yarn add @rails/webpacker@next
310
469
  ```
311
470
 
312
- ## Integrations
313
-
314
- Webpacker ships with basic out-of-the-box integration. You can see a list of available commands/tasks by running `bundle exec rails webpacker`.
315
-
316
- Included install integrations:
317
-
318
- - [React](./docs/integrations.md#React)
319
- - [Angular with TypeScript](./docs/integrations.md#Angular-with-TypeScript)
320
- - [Vue](./docs/integrations.md#Vue)
321
- - [Elm](./docs/integrations.md#Elm)
322
- - [Svelte](./docs/integrations.md#Svelte)
323
- - [Stimulus](./docs/integrations.md#Stimulus)
324
- - [CoffeeScript](./docs/integrations.md#CoffeeScript)
325
- - [Typescript](./docs/typescript.md)
326
- - [Erb](./docs/integrations.md#Erb)
327
-
328
- See [Integrations](./docs/integrations.md) for further details.
329
-
330
471
  ## Paths
331
472
 
332
473
  By default, Webpacker ships with simple conventions for where the JavaScript
@@ -362,7 +503,7 @@ development:
362
503
 
363
504
  If you have `hmr` turned to true, then the `stylesheet_pack_tag` generates no output, as you will want to configure your styles to be inlined in your JavaScript for hot reloading. During production and testing, the `stylesheet_pack_tag` will create the appropriate HTML tags.
364
505
 
365
- ### Resolved
506
+ ### Additional paths
366
507
 
367
508
  If you are adding Webpacker to an existing app that has most of the assets inside
368
509
  `app/assets` or inside an engine, and you want to share that
@@ -371,7 +512,7 @@ option available in `config/webpacker.yml`. This lets you
371
512
  add additional paths that webpack should lookup when resolving modules:
372
513
 
373
514
  ```yml
374
- additional_paths: ['app/assets']
515
+ additional_paths: ['app/assets/**/*', 'vendor/assets/**/*.css', 'Gemfile']
375
516
  ```
376
517
 
377
518
  You can then import these items inside your modules like so:
@@ -392,26 +533,6 @@ Webpacker hooks up a new `webpacker:compile` task to `assets:precompile`, which
392
533
 
393
534
  When compiling assets for production on a remote server, such as a continuous integration environment, it's recommended to use `yarn install --frozen-lockfile` to install NPM packages on the remote host to ensure that the installed packages match the `yarn.lock` file.
394
535
 
395
- ## Docs
396
-
397
- - [Development](https://github.com/rails/webpacker#development)
398
- - [Webpack](./docs/webpack.md)
399
- - [Webpack-dev-server](./docs/webpack-dev-server.md)
400
- - [Environment Variables](./docs/env.md)
401
- - [Folder Structure](./docs/folder-structure.md)
402
- - [Assets](./docs/assets.md) - [CSS, Sass and SCSS](./docs/css.md) - [ES6](./docs/es6.md), [Target browsers](./docs/target.md)
403
- - [Props](./docs/props.md)
404
- - [Typescript](./docs/typescript.md)
405
- - [Yarn](./docs/yarn.md)
406
- - [Misc](./docs/misc.md)
407
- - [Deployment](./docs/deployment.md)
408
- - [Docker](./docs/docker.md)
409
- - [Using in Rails engines](./docs/engines.md)
410
- - [Webpacker on Cloud9](./docs/cloud9.md)
411
- - [Testing](./docs/testing.md)
412
- - [Troubleshooting](./docs/troubleshooting.md)
413
- - [v3 to v4 Upgrade Guide](./docs/v4-upgrade.md)
414
-
415
536
  ## Contributing
416
537
 
417
538
  [![Code Helpers](https://www.codetriage.com/rails/webpacker/badges/users.svg)](https://www.codetriage.com/rails/webpacker)
@@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
4
4
 
5
5
  gemspec path: "../"
6
6
 
7
- gem "rails", github: "rails/rails", branch: "main"
7
+ gem "rails", github: "rails/rails"
8
8
  gem "arel", github: "rails/arel"
9
9
  gem "rake", ">= 11.1"
10
10
  gem "rack-proxy", require: false
@@ -0,0 +1,3 @@
1
+ const { webpackConfig } = require('@rails/webpacker')
2
+
3
+ module.exports = webpackConfig
@@ -1,5 +1,5 @@
1
1
  process.env.NODE_ENV = process.env.NODE_ENV || 'development'
2
2
 
3
- const environment = require('./environment')
3
+ const webpackConfig = require('./base')
4
4
 
5
- module.exports = environment.toWebpackConfig()
5
+ module.exports = webpackConfig
@@ -1,5 +1,5 @@
1
1
  process.env.NODE_ENV = process.env.NODE_ENV || 'production'
2
2
 
3
- const environment = require('./environment')
3
+ const webpackConfig = require('./base')
4
4
 
5
- module.exports = environment.toWebpackConfig()
5
+ module.exports = webpackConfig