webpacker 4.3.0 → 5.0.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.
- checksums.yaml +4 -4
 - data/.node-version +1 -1
 - data/.travis.yml +8 -22
 - data/CHANGELOG.md +17 -6
 - data/Gemfile +1 -0
 - data/Gemfile.lock +8 -5
 - data/README.md +25 -229
 - data/docs/css.md +3 -4
 - data/docs/deployment.md +2 -2
 - data/docs/docker.md +17 -17
 - data/docs/engines.md +13 -0
 - data/docs/integrations.md +220 -0
 - data/docs/typescript.md +2 -3
 - data/lib/install/loaders/svelte.js +2 -2
 - data/lib/install/template.rb +1 -1
 - data/lib/tasks/webpacker/check_node.rake +14 -7
 - data/lib/tasks/webpacker/check_yarn.rake +16 -9
 - data/lib/tasks/webpacker/clean.rake +12 -6
 - data/lib/tasks/webpacker/clobber.rake +8 -4
 - data/lib/tasks/webpacker/yarn_install.rake +5 -16
 - data/lib/webpacker/commands.rb +33 -9
 - data/lib/webpacker/dev_server_runner.rb +4 -4
 - data/lib/webpacker/manifest.rb +4 -4
 - data/lib/webpacker/version.rb +1 -1
 - data/package.json +26 -26
 - data/package/environments/__tests__/base.js +10 -0
 - data/package/environments/base.js +12 -1
 - data/package/environments/development.js +0 -4
 - data/package/rules/sass.js +2 -1
 - data/test/manifest_test.rb +37 -6
 - data/test/rake_tasks_test.rb +11 -0
 - data/test/test_app/app/javascript/packs/multi_entry.css +4 -0
 - data/test/test_app/app/javascript/packs/multi_entry.js +4 -0
 - data/webpacker.gemspec +4 -3
 - data/yarn.lock +1131 -712
 - metadata +28 -12
 - data/gemfiles/Gemfile-rails.4.2.x +0 -9
 - data/gemfiles/Gemfile-rails.5.0.x +0 -9
 - data/gemfiles/Gemfile-rails.5.1.x +0 -9
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 90b70d4a35ee4060d806e7c9cb1a9d84911ea44d694624702c114f127b056898
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9154bed025c8ba24e1a86a9beecf02565801e476d5e3d0c3da5e852dba12c5d5
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f4f268225c02c17af8084b90ee0c77063956abbb151c35ad0dcb3796120316cd743ea8255112b5e45631ecbd007ca730b9730673dfb38776b138936203678d42
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 0a7eed57357510f8beac760b74b1e83e19d1e3bca477be1fbb0fa26cc7844f71936062cbd18126b7e48853768fbfc20e6bd31f0585cf55139ac402d39850a134
         
     | 
    
        data/.node-version
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            10.13.0
         
     | 
    
        data/.travis.yml
    CHANGED
    
    | 
         @@ -1,23 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            language: ruby
         
     | 
| 
       2 
2 
     | 
    
         
             
            dist: xenial
         
     | 
| 
       3 
3 
     | 
    
         
             
            before_install:
         
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
       5 
     | 
    
         
            -
               
     | 
| 
       6 
     | 
    
         
            -
              # CI while Ruby 2.6 does not.
         
     | 
| 
       7 
     | 
    
         
            -
              # https://github.com/travis-ci/travis-rubies/issues/57#issuecomment-458981237
         
     | 
| 
       8 
     | 
    
         
            -
              - rvm gemset create travis
         
     | 
| 
       9 
     | 
    
         
            -
              - rvm gemset use travis
         
     | 
| 
       10 
     | 
    
         
            -
              - gem install bundler -v 1.17.3
         
     | 
| 
      
 4 
     | 
    
         
            +
              - gem install rubygems-update && update_rubygems
         
     | 
| 
      
 5 
     | 
    
         
            +
              - yes | rvm @global do gem install bundler -v 2.1.4 || true
         
     | 
| 
       11 
6 
     | 
    
         
             
            rvm:
         
     | 
| 
       12 
     | 
    
         
            -
              - 2. 
     | 
| 
       13 
     | 
    
         
            -
              - 2.4.6
         
     | 
| 
      
 7 
     | 
    
         
            +
              - 2.4.9
         
     | 
| 
       14 
8 
     | 
    
         
             
              - 2.5.5
         
     | 
| 
       15 
     | 
    
         
            -
              - 2.6. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 2.6.5
         
     | 
| 
      
 10 
     | 
    
         
            +
              - 2.7.0
         
     | 
| 
       16 
11 
     | 
    
         
             
              - ruby-head
         
     | 
| 
       17 
12 
     | 
    
         
             
            gemfile:
         
     | 
| 
       18 
     | 
    
         
            -
              - gemfiles/Gemfile-rails.4.2.x
         
     | 
| 
       19 
     | 
    
         
            -
              - gemfiles/Gemfile-rails.5.0.x
         
     | 
| 
       20 
     | 
    
         
            -
              - gemfiles/Gemfile-rails.5.1.x
         
     | 
| 
       21 
13 
     | 
    
         
             
              - gemfiles/Gemfile-rails.5.2.x
         
     | 
| 
       22 
14 
     | 
    
         
             
              - gemfiles/Gemfile-rails.6.0.x
         
     | 
| 
       23 
15 
     | 
    
         
             
              - gemfiles/Gemfile-rails-edge
         
     | 
| 
         @@ -29,7 +21,7 @@ cache: 
     | 
|
| 
       29 
21 
     | 
    
         | 
| 
       30 
22 
     | 
    
         
             
            install:
         
     | 
| 
       31 
23 
     | 
    
         
             
              - bundle install --jobs 3 --retry 3
         
     | 
| 
       32 
     | 
    
         
            -
              - nvm install  
     | 
| 
      
 24 
     | 
    
         
            +
              - nvm install 12
         
     | 
| 
       33 
25 
     | 
    
         
             
              - node -v
         
     | 
| 
       34 
26 
     | 
    
         
             
              - npm i -g yarn
         
     | 
| 
       35 
27 
     | 
    
         
             
              - yarn
         
     | 
| 
         @@ -43,15 +35,9 @@ matrix: 
     | 
|
| 
       43 
35 
     | 
    
         
             
                - gemfile: gemfiles/Gemfile-rails-edge
         
     | 
| 
       44 
36 
     | 
    
         
             
                - rvm: ruby-head
         
     | 
| 
       45 
37 
     | 
    
         
             
              exclude:
         
     | 
| 
       46 
     | 
    
         
            -
                - rvm: 2. 
     | 
| 
       47 
     | 
    
         
            -
                  gemfile: gemfiles/Gemfile-rails-edge
         
     | 
| 
       48 
     | 
    
         
            -
                - rvm: 2.4.6
         
     | 
| 
      
 38 
     | 
    
         
            +
                - rvm: 2.4.9
         
     | 
| 
       49 
39 
     | 
    
         
             
                  gemfile: gemfiles/Gemfile-rails-edge
         
     | 
| 
       50 
40 
     | 
    
         
             
                - rvm: 2.5.5
         
     | 
| 
       51 
41 
     | 
    
         
             
                  gemfile: gemfiles/Gemfile-rails-edge
         
     | 
| 
       52 
     | 
    
         
            -
                - rvm:  
     | 
| 
       53 
     | 
    
         
            -
                  gemfile: gemfiles/Gemfile-rails.4.2.x
         
     | 
| 
       54 
     | 
    
         
            -
                - rvm: 2.3.8
         
     | 
| 
       55 
     | 
    
         
            -
                  gemfile: gemfiles/Gemfile-rails.6.0.x
         
     | 
| 
       56 
     | 
    
         
            -
                - rvm: 2.4.6
         
     | 
| 
      
 42 
     | 
    
         
            +
                - rvm: 2.4.9
         
     | 
| 
       57 
43 
     | 
    
         
             
                  gemfile: gemfiles/Gemfile-rails.6.0.x
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -2,9 +2,22 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            **Please note that Webpacker 4.1.0 has an installer bug. Please use 4.2.0 or above**
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            ## [[ 
     | 
| 
      
 5 
     | 
    
         
            +
            ## [[5.0.0]](https://github.com/rails/webpacker/compare/v4.2.2...v5.0.0) - 2020-03-22
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
            - Bump  
     | 
| 
      
 7 
     | 
    
         
            +
            - Bump minimum node version [#2428](https://github.com/rails/webpacker/pull/2428)
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Bump minimum ruby/rails version [#2415](https://github.com/rails/webpacker/pull/2415)
         
     | 
| 
      
 9 
     | 
    
         
            +
            - Add support for multiple files per entry [#2476](https://github.com/rails/webpacker/pull/2476)
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ```js
         
     | 
| 
      
 12 
     | 
    
         
            +
              entry: {
         
     | 
| 
      
 13 
     | 
    
         
            +
                home: ['./home.js', './home.scss'],
         
     | 
| 
      
 14 
     | 
    
         
            +
                account: ['./account.js', './account.scss']
         
     | 
| 
      
 15 
     | 
    
         
            +
              }
         
     | 
| 
      
 16 
     | 
    
         
            +
            ```
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            You can now have two entry files with same names inside packs folder, `home.scss` and `home.js`
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            And, other minor fixes, please see a list of changes [here](https://github.com/rails/webpacker/compare/v4.2.2...v5.0.0)
         
     | 
| 
       8 
21 
     | 
    
         | 
| 
       9 
22 
     | 
    
         
             
            ## [[4.2.2]](https://github.com/rails/webpacker/compare/v4.2.1...v4.2.2) - 2019-12-09
         
     | 
| 
       10 
23 
     | 
    
         | 
| 
         @@ -297,7 +310,7 @@ const { environment } = require('@rails/webpacker') 
     | 
|
| 
       297 
310 
     | 
    
         
             
            // Enable with default config
         
     | 
| 
       298 
311 
     | 
    
         
             
            environment.splitChunks()
         
     | 
| 
       299 
312 
     | 
    
         
             
            // Configure via a callback
         
     | 
| 
       300 
     | 
    
         
            -
            environment.splitChunks( 
     | 
| 
      
 313 
     | 
    
         
            +
            environment.splitChunks(config =>
         
     | 
| 
       301 
314 
     | 
    
         
             
              Object.assign({}, config, { optimization: { splitChunks: false } })
         
     | 
| 
       302 
315 
     | 
    
         
             
            )
         
     | 
| 
       303 
316 
     | 
    
         
             
            ```
         
     | 
| 
         @@ -621,9 +634,7 @@ environment.resolvedModules.append('vendor', 'vendor') 
     | 
|
| 
       621 
634 
     | 
    
         
             
            ```js
         
     | 
| 
       622 
635 
     | 
    
         
             
            // Enable css modules with sass loader
         
     | 
| 
       623 
636 
     | 
    
         
             
            const sassLoader = environment.loaders.get('sass')
         
     | 
| 
       624 
     | 
    
         
            -
            const cssLoader = sassLoader.use.find(
         
     | 
| 
       625 
     | 
    
         
            -
              (loader) => loader.loader === 'css-loader'
         
     | 
| 
       626 
     | 
    
         
            -
            )
         
     | 
| 
      
 637 
     | 
    
         
            +
            const cssLoader = sassLoader.use.find(loader => loader.loader === 'css-loader')
         
     | 
| 
       627 
638 
     | 
    
         | 
| 
       628 
639 
     | 
    
         
             
            cssLoader.options = Object.assign({}, cssLoader.options, {
         
     | 
| 
       629 
640 
     | 
    
         
             
              modules: true,
         
     | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,10 +1,11 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            PATH
         
     | 
| 
       2 
2 
     | 
    
         
             
              remote: .
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                webpacker ( 
     | 
| 
       5 
     | 
    
         
            -
                  activesupport (>=  
     | 
| 
      
 4 
     | 
    
         
            +
                webpacker (5.0.0)
         
     | 
| 
      
 5 
     | 
    
         
            +
                  activesupport (>= 5.2)
         
     | 
| 
       6 
6 
     | 
    
         
             
                  rack-proxy (>= 0.6.1)
         
     | 
| 
       7 
     | 
    
         
            -
                  railties (>=  
     | 
| 
      
 7 
     | 
    
         
            +
                  railties (>= 5.2)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  semantic_range (>= 2.3.0)
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
10 
     | 
    
         
             
            GEM
         
     | 
| 
       10 
11 
     | 
    
         
             
              remote: https://rubygems.org/
         
     | 
| 
         @@ -88,12 +89,12 @@ GEM 
     | 
|
| 
       88 
89 
     | 
    
         
             
                mini_portile2 (2.4.0)
         
     | 
| 
       89 
90 
     | 
    
         
             
                minitest (5.13.0)
         
     | 
| 
       90 
91 
     | 
    
         
             
                nio4r (2.5.2)
         
     | 
| 
       91 
     | 
    
         
            -
                nokogiri (1.10. 
     | 
| 
      
 92 
     | 
    
         
            +
                nokogiri (1.10.8)
         
     | 
| 
       92 
93 
     | 
    
         
             
                  mini_portile2 (~> 2.4.0)
         
     | 
| 
       93 
94 
     | 
    
         
             
                parallel (1.18.0)
         
     | 
| 
       94 
95 
     | 
    
         
             
                parser (2.6.5.0)
         
     | 
| 
       95 
96 
     | 
    
         
             
                  ast (~> 2.4.0)
         
     | 
| 
       96 
     | 
    
         
            -
                rack (2.0. 
     | 
| 
      
 97 
     | 
    
         
            +
                rack (2.0.8)
         
     | 
| 
       97 
98 
     | 
    
         
             
                rack-proxy (0.6.5)
         
     | 
| 
       98 
99 
     | 
    
         
             
                  rack
         
     | 
| 
       99 
100 
     | 
    
         
             
                rack-test (1.1.0)
         
     | 
| 
         @@ -136,6 +137,7 @@ GEM 
     | 
|
| 
       136 
137 
     | 
    
         
             
                rubocop-performance (1.3.0)
         
     | 
| 
       137 
138 
     | 
    
         
             
                  rubocop (>= 0.68.0)
         
     | 
| 
       138 
139 
     | 
    
         
             
                ruby-progressbar (1.10.1)
         
     | 
| 
      
 140 
     | 
    
         
            +
                semantic_range (2.3.0)
         
     | 
| 
       139 
141 
     | 
    
         
             
                sprockets (4.0.0)
         
     | 
| 
       140 
142 
     | 
    
         
             
                  concurrent-ruby (~> 1.0)
         
     | 
| 
       141 
143 
     | 
    
         
             
                  rack (> 1, < 3)
         
     | 
| 
         @@ -165,6 +167,7 @@ DEPENDENCIES 
     | 
|
| 
       165 
167 
     | 
    
         
             
              rake (>= 11.1)
         
     | 
| 
       166 
168 
     | 
    
         
             
              rubocop (< 0.69)
         
     | 
| 
       167 
169 
     | 
    
         
             
              rubocop-performance
         
     | 
| 
      
 170 
     | 
    
         
            +
              semantic_range
         
     | 
| 
       168 
171 
     | 
    
         
             
              webpacker!
         
     | 
| 
       169 
172 
     | 
    
         | 
| 
       170 
173 
     | 
    
         
             
            BUNDLED WITH
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,8 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Webpacker
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            [](https://travis-ci.org/rails/webpacker)
         
     | 
| 
       4 
     | 
    
         
            -
            [](https:// 
     | 
| 
      
 4 
     | 
    
         
            +
            [](https://www.npmjs.com/package/@rails/webpacker)
         
     | 
| 
      
 5 
     | 
    
         
            +
            [](https://rubygems.org/gems/webpacker)
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            Webpacker makes it easy to use the JavaScript pre-processor and bundler
         
     | 
| 
       8 
8 
     | 
    
         
             
            [webpack 4.x.x+](https://webpack.js.org/)
         
     | 
| 
         @@ -29,14 +29,14 @@ in which case you may not even need the asset pipeline. This is mostly relevant 
     | 
|
| 
       29 
29 
     | 
    
         
             
              - [Upgrading](#upgrading)
         
     | 
| 
       30 
30 
     | 
    
         
             
              - [Yarn Integrity](#yarn-integrity)
         
     | 
| 
       31 
31 
     | 
    
         
             
            - [Integrations](#integrations)
         
     | 
| 
       32 
     | 
    
         
            -
              - [React](#react)
         
     | 
| 
       33 
     | 
    
         
            -
              - [Angular with TypeScript](#angular-with-typescript)
         
     | 
| 
       34 
     | 
    
         
            -
              - [Vue](#vue)
         
     | 
| 
       35 
     | 
    
         
            -
              - [Elm](#elm)
         
     | 
| 
       36 
     | 
    
         
            -
              - [Stimulus](#stimulus)
         
     | 
| 
       37 
     | 
    
         
            -
              - [Svelte](#svelte)
         
     | 
| 
       38 
     | 
    
         
            -
              - [CoffeeScript](#coffeescript)
         
     | 
| 
       39 
     | 
    
         
            -
              - [Erb](#erb)
         
     | 
| 
      
 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 
     | 
    
         
            +
              - [CoffeeScript](./docs/integrations.md#coffeescript)
         
     | 
| 
      
 39 
     | 
    
         
            +
              - [Erb](./docs/integrations.md#erb)
         
     | 
| 
       40 
40 
     | 
    
         
             
            - [Paths](#paths)
         
     | 
| 
       41 
41 
     | 
    
         
             
              - [Resolved](#resolved)
         
     | 
| 
       42 
42 
     | 
    
         
             
              - [Watched](#watched)
         
     | 
| 
         @@ -50,9 +50,9 @@ in which case you may not even need the asset pipeline. This is mostly relevant 
     | 
|
| 
       50 
50 
     | 
    
         | 
| 
       51 
51 
     | 
    
         
             
            ## Prerequisites
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
            * Ruby 2. 
     | 
| 
       54 
     | 
    
         
            -
            * Rails  
     | 
| 
       55 
     | 
    
         
            -
            * Node.js  
     | 
| 
      
 53 
     | 
    
         
            +
            * Ruby 2.4+
         
     | 
| 
      
 54 
     | 
    
         
            +
            * Rails 5.2+
         
     | 
| 
      
 55 
     | 
    
         
            +
            * Node.js 10.13.0+
         
     | 
| 
       56 
56 
     | 
    
         
             
            * Yarn 1.x+
         
     | 
| 
       57 
57 
     | 
    
         | 
| 
       58 
58 
     | 
    
         | 
| 
         @@ -327,225 +327,21 @@ You may also turn on this feature by adding the config option for any Rails envi 
     | 
|
| 
       327 
327 
     | 
    
         | 
| 
       328 
328 
     | 
    
         
             
            ## Integrations
         
     | 
| 
       329 
329 
     | 
    
         | 
| 
       330 
     | 
    
         
            -
            Webpacker ships with basic out-of-the-box integration  
     | 
| 
       331 
     | 
    
         
            -
            You can see a list of available commands/tasks by running `bundle exec rails webpacker`:
         
     | 
| 
      
 330 
     | 
    
         
            +
            Webpacker ships with basic out-of-the-box integration. You can see a list of available commands/tasks by running `bundle exec rails webpacker`.
         
     | 
| 
       332 
331 
     | 
    
         | 
| 
       333 
     | 
    
         
            -
             
     | 
| 
      
 332 
     | 
    
         
            +
            Included install integrations:
         
     | 
| 
       334 
333 
     | 
    
         | 
| 
       335 
     | 
    
         
            -
             
     | 
| 
       336 
     | 
    
         
            -
             
     | 
| 
       337 
     | 
    
         
            -
             
     | 
| 
       338 
     | 
    
         
            -
             
     | 
| 
       339 
     | 
    
         
            -
             
     | 
| 
       340 
     | 
    
         
            -
             
     | 
| 
       341 
     | 
    
         
            -
             
     | 
| 
       342 
     | 
    
         
            -
             
     | 
| 
       343 
     | 
    
         
            -
            ( 
     | 
| 
       344 
     | 
    
         
            -
            setup with Webpacker).
         
     | 
| 
       345 
     | 
    
         
            -
             
     | 
| 
       346 
     | 
    
         
            -
            The installer will add all relevant dependencies using Yarn, changes
         
     | 
| 
       347 
     | 
    
         
            -
            to the configuration files, and an example React component to your
         
     | 
| 
       348 
     | 
    
         
            -
            project in `app/javascript/packs` so that you can experiment with React right away.
         
     | 
| 
       349 
     | 
    
         
            -
             
     | 
| 
       350 
     | 
    
         
            -
             
     | 
| 
       351 
     | 
    
         
            -
            ### Angular with TypeScript
         
     | 
| 
       352 
     | 
    
         
            -
             
     | 
| 
       353 
     | 
    
         
            -
            To use Webpacker with [Angular](https://angular.io/), create a
         
     | 
| 
       354 
     | 
    
         
            -
            new Rails 5.1+ app using `--webpack=angular` option:
         
     | 
| 
       355 
     | 
    
         
            -
             
     | 
| 
       356 
     | 
    
         
            -
            ```bash
         
     | 
| 
       357 
     | 
    
         
            -
            # Rails 5.1+
         
     | 
| 
       358 
     | 
    
         
            -
            rails new myapp --webpack=angular
         
     | 
| 
       359 
     | 
    
         
            -
            ```
         
     | 
| 
       360 
     | 
    
         
            -
             
     | 
| 
       361 
     | 
    
         
            -
            (or run `bundle exec rails webpacker:install:angular` on a Rails app already
         
     | 
| 
       362 
     | 
    
         
            -
            setup with Webpacker).
         
     | 
| 
       363 
     | 
    
         
            -
             
     | 
| 
       364 
     | 
    
         
            -
            The installer will add the TypeScript and Angular core libraries using Yarn alongside
         
     | 
| 
       365 
     | 
    
         
            -
            a few changes to the configuration files. An example component written in
         
     | 
| 
       366 
     | 
    
         
            -
            TypeScript will also be added to your project in `app/javascript` so that
         
     | 
| 
       367 
     | 
    
         
            -
            you can experiment with Angular right away.
         
     | 
| 
       368 
     | 
    
         
            -
             
     | 
| 
       369 
     | 
    
         
            -
            By default, Angular uses a JIT compiler for development environment. This
         
     | 
| 
       370 
     | 
    
         
            -
            compiler is not compatible with restrictive CSP (Content Security
         
     | 
| 
       371 
     | 
    
         
            -
            Policy) environments like Rails 5.2+. You can use Angular AOT compiler
         
     | 
| 
       372 
     | 
    
         
            -
            in development with the [@ngtools/webpack](https://www.npmjs.com/package/@ngtools/webpack#usage) plugin.
         
     | 
| 
       373 
     | 
    
         
            -
             
     | 
| 
       374 
     | 
    
         
            -
            Alternatively if you're using Rails 5.2+ you can enable `unsafe-eval` rule for your
         
     | 
| 
       375 
     | 
    
         
            -
            development environment. This can be done in the `config/initializers/content_security_policy.rb`
         
     | 
| 
       376 
     | 
    
         
            -
            with the following code:
         
     | 
| 
       377 
     | 
    
         
            -
             
     | 
| 
       378 
     | 
    
         
            -
            ```ruby
         
     | 
| 
       379 
     | 
    
         
            -
            Rails.application.config.content_security_policy do |policy|
         
     | 
| 
       380 
     | 
    
         
            -
              if Rails.env.development?
         
     | 
| 
       381 
     | 
    
         
            -
                policy.script_src :self, :https, :unsafe_eval
         
     | 
| 
       382 
     | 
    
         
            -
              else
         
     | 
| 
       383 
     | 
    
         
            -
                policy.script_src :self, :https
         
     | 
| 
       384 
     | 
    
         
            -
              end
         
     | 
| 
       385 
     | 
    
         
            -
            end
         
     | 
| 
       386 
     | 
    
         
            -
            ```
         
     | 
| 
       387 
     | 
    
         
            -
             
     | 
| 
       388 
     | 
    
         
            -
             
     | 
| 
       389 
     | 
    
         
            -
            ### Vue
         
     | 
| 
       390 
     | 
    
         
            -
             
     | 
| 
       391 
     | 
    
         
            -
            To use Webpacker with [Vue](https://vuejs.org/), create a
         
     | 
| 
       392 
     | 
    
         
            -
            new Rails 5.1+ app using `--webpack=vue` option:
         
     | 
| 
       393 
     | 
    
         
            -
             
     | 
| 
       394 
     | 
    
         
            -
            ```bash
         
     | 
| 
       395 
     | 
    
         
            -
            # Rails 5.1+
         
     | 
| 
       396 
     | 
    
         
            -
            rails new myapp --webpack=vue
         
     | 
| 
       397 
     | 
    
         
            -
            ```
         
     | 
| 
       398 
     | 
    
         
            -
            (or run `bundle exec rails webpacker:install:vue` on a Rails app already setup with Webpacker).
         
     | 
| 
       399 
     | 
    
         
            -
             
     | 
| 
       400 
     | 
    
         
            -
            The installer will add Vue and its required libraries using Yarn alongside
         
     | 
| 
       401 
     | 
    
         
            -
            automatically applying changes needed to the configuration files. An example component will
         
     | 
| 
       402 
     | 
    
         
            -
            be added to your project in `app/javascript` so that you can experiment with Vue right away.
         
     | 
| 
       403 
     | 
    
         
            -
             
     | 
| 
       404 
     | 
    
         
            -
            If you're using Rails 5.2+ you'll need to enable `unsafe-eval` rule for your development environment.
         
     | 
| 
       405 
     | 
    
         
            -
            This can be done in the `config/initializers/content_security_policy.rb` with the following
         
     | 
| 
       406 
     | 
    
         
            -
            configuration:
         
     | 
| 
       407 
     | 
    
         
            -
             
     | 
| 
       408 
     | 
    
         
            -
            ```ruby
         
     | 
| 
       409 
     | 
    
         
            -
            Rails.application.config.content_security_policy do |policy|
         
     | 
| 
       410 
     | 
    
         
            -
              if Rails.env.development?
         
     | 
| 
       411 
     | 
    
         
            -
                policy.script_src :self, :https, :unsafe_eval
         
     | 
| 
       412 
     | 
    
         
            -
              else
         
     | 
| 
       413 
     | 
    
         
            -
                policy.script_src :self, :https
         
     | 
| 
       414 
     | 
    
         
            -
              end
         
     | 
| 
       415 
     | 
    
         
            -
            end
         
     | 
| 
       416 
     | 
    
         
            -
            ```
         
     | 
| 
       417 
     | 
    
         
            -
            You can read more about this in the [Vue docs](https://vuejs.org/v2/guide/installation.html#CSP-environments).
         
     | 
| 
       418 
     | 
    
         
            -
             
     | 
| 
       419 
     | 
    
         
            -
            #### Lazy loading integration
         
     | 
| 
       420 
     | 
    
         
            -
             
     | 
| 
       421 
     | 
    
         
            -
            See [docs/es6](docs/es6.md) to know more about Webpack and Webpacker configuration.
         
     | 
| 
       422 
     | 
    
         
            -
             
     | 
| 
       423 
     | 
    
         
            -
            For instance, you can lazy load Vue JS components:
         
     | 
| 
       424 
     | 
    
         
            -
             
     | 
| 
       425 
     | 
    
         
            -
            Before:
         
     | 
| 
       426 
     | 
    
         
            -
            ```js
         
     | 
| 
       427 
     | 
    
         
            -
            import Vue from 'vue'
         
     | 
| 
       428 
     | 
    
         
            -
            import { VCard } from 'vuetify/lib'
         
     | 
| 
       429 
     | 
    
         
            -
             
     | 
| 
       430 
     | 
    
         
            -
            Vue.component('VCard', VCard)
         
     | 
| 
       431 
     | 
    
         
            -
            ```
         
     | 
| 
       432 
     | 
    
         
            -
             
     | 
| 
       433 
     | 
    
         
            -
            After:
         
     | 
| 
       434 
     | 
    
         
            -
            ```js
         
     | 
| 
       435 
     | 
    
         
            -
            import Vue from 'vue'
         
     | 
| 
       436 
     | 
    
         
            -
             
     | 
| 
       437 
     | 
    
         
            -
            // With destructuring assignment
         
     | 
| 
       438 
     | 
    
         
            -
            Vue.component('VCard', import('vuetify/lib').then(({ VCard }) => VCard)
         
     | 
| 
       439 
     | 
    
         
            -
             
     | 
| 
       440 
     | 
    
         
            -
            // Or without destructuring assignment
         
     | 
| 
       441 
     | 
    
         
            -
            Vue.component('OtherComponent', () => import('./OtherComponent'))
         
     | 
| 
       442 
     | 
    
         
            -
            ```
         
     | 
| 
       443 
     | 
    
         
            -
             
     | 
| 
       444 
     | 
    
         
            -
            You can use it in a Single File Component as well:
         
     | 
| 
       445 
     | 
    
         
            -
             
     | 
| 
       446 
     | 
    
         
            -
            ```html
         
     | 
| 
       447 
     | 
    
         
            -
            <template>
         
     | 
| 
       448 
     | 
    
         
            -
              ...
         
     | 
| 
       449 
     | 
    
         
            -
            </template>
         
     | 
| 
       450 
     | 
    
         
            -
             
     | 
| 
       451 
     | 
    
         
            -
            <script>
         
     | 
| 
       452 
     | 
    
         
            -
            export default {
         
     | 
| 
       453 
     | 
    
         
            -
              components: {
         
     | 
| 
       454 
     | 
    
         
            -
                OtherComponent: () => import('./OtherComponent')
         
     | 
| 
       455 
     | 
    
         
            -
              }
         
     | 
| 
       456 
     | 
    
         
            -
            }
         
     | 
| 
       457 
     | 
    
         
            -
            </script>
         
     | 
| 
       458 
     | 
    
         
            -
            ```
         
     | 
| 
       459 
     | 
    
         
            -
             
     | 
| 
       460 
     | 
    
         
            -
            By wrapping the import function into an arrow function, Vue will execute it only when it gets requested, loading the module in that moment.
         
     | 
| 
       461 
     | 
    
         
            -
             
     | 
| 
       462 
     | 
    
         
            -
            ##### Automatic registration
         
     | 
| 
       463 
     | 
    
         
            -
             
     | 
| 
       464 
     | 
    
         
            -
            ```js
         
     | 
| 
       465 
     | 
    
         
            -
            /**
         
     | 
| 
       466 
     | 
    
         
            -
             * The following block of code may be used to automatically register your
         
     | 
| 
       467 
     | 
    
         
            -
             * Vue components. It will recursively scan this directory for the Vue
         
     | 
| 
       468 
     | 
    
         
            -
             * components and automatically register them with their "basename".
         
     | 
| 
       469 
     | 
    
         
            -
             *
         
     | 
| 
       470 
     | 
    
         
            -
             * Eg. ./components/OtherComponent.vue -> <other-component></other-component>
         
     | 
| 
       471 
     | 
    
         
            -
             * Eg. ./UI/ButtonComponent.vue -> <button-component></button-component>
         
     | 
| 
       472 
     | 
    
         
            -
             */
         
     | 
| 
       473 
     | 
    
         
            -
             
     | 
| 
       474 
     | 
    
         
            -
            const files = require.context('./', true, /\.vue$/i)
         
     | 
| 
       475 
     | 
    
         
            -
            files.keys().map(key => {
         
     | 
| 
       476 
     | 
    
         
            -
              const component = key.split('/').pop().split('.')[0]
         
     | 
| 
       477 
     | 
    
         
            -
             
     | 
| 
       478 
     | 
    
         
            -
              // With Lazy Loading
         
     | 
| 
       479 
     | 
    
         
            -
              Vue.component(component, () => import(`${key}`))
         
     | 
| 
       480 
     | 
    
         
            -
             
     | 
| 
       481 
     | 
    
         
            -
              // Or without Lazy Loading
         
     | 
| 
       482 
     | 
    
         
            -
              Vue.component(component, files(key).default)
         
     | 
| 
       483 
     | 
    
         
            -
            })
         
     | 
| 
       484 
     | 
    
         
            -
            ```
         
     | 
| 
       485 
     | 
    
         
            -
             
     | 
| 
       486 
     | 
    
         
            -
            ### Elm
         
     | 
| 
       487 
     | 
    
         
            -
             
     | 
| 
       488 
     | 
    
         
            -
            To use Webpacker with [Elm](http://elm-lang.org), create a
         
     | 
| 
       489 
     | 
    
         
            -
            new Rails 5.1+ app using `--webpack=elm` option:
         
     | 
| 
       490 
     | 
    
         
            -
             
     | 
| 
       491 
     | 
    
         
            -
            ```
         
     | 
| 
       492 
     | 
    
         
            -
            # Rails 5.1+
         
     | 
| 
       493 
     | 
    
         
            -
            rails new myapp --webpack=elm
         
     | 
| 
       494 
     | 
    
         
            -
            ```
         
     | 
| 
       495 
     | 
    
         
            -
             
     | 
| 
       496 
     | 
    
         
            -
            (or run `bundle exec rails webpacker:install:elm` on a Rails app already setup with Webpacker).
         
     | 
| 
       497 
     | 
    
         
            -
             
     | 
| 
       498 
     | 
    
         
            -
            The Elm library and its core packages will be added via Yarn and Elm.
         
     | 
| 
       499 
     | 
    
         
            -
            An example `Main.elm` app will also be added to your project in `app/javascript`
         
     | 
| 
       500 
     | 
    
         
            -
            so that you can experiment with Elm right away.
         
     | 
| 
       501 
     | 
    
         
            -
             
     | 
| 
       502 
     | 
    
         
            -
            ### Svelte
         
     | 
| 
       503 
     | 
    
         
            -
             
     | 
| 
       504 
     | 
    
         
            -
            To use Webpacker with [Svelte](https://svelte.dev), create a
         
     | 
| 
       505 
     | 
    
         
            -
            new Rails 5.1+ app using `--webpack=svelte` option:
         
     | 
| 
       506 
     | 
    
         
            -
             
     | 
| 
       507 
     | 
    
         
            -
            ```
         
     | 
| 
       508 
     | 
    
         
            -
            # Rails 5.1+
         
     | 
| 
       509 
     | 
    
         
            -
            rails new myapp --webpack=svelte
         
     | 
| 
       510 
     | 
    
         
            -
            ```
         
     | 
| 
       511 
     | 
    
         
            -
             
     | 
| 
       512 
     | 
    
         
            -
            (or run `bundle exec rails webpacker:install:svelte` on a Rails app already setup with Webpacker).
         
     | 
| 
       513 
     | 
    
         
            -
             
     | 
| 
       514 
     | 
    
         
            -
            Please play with the [Svelte Tutorial](https://svelte.dev/tutorial/basics) or learn more about its API at https://svelte.dev/docs
         
     | 
| 
       515 
     | 
    
         
            -
             
     | 
| 
       516 
     | 
    
         
            -
            ### Stimulus
         
     | 
| 
       517 
     | 
    
         
            -
             
     | 
| 
       518 
     | 
    
         
            -
            To use Webpacker with [Stimulus](http://stimulusjs.org), create a
         
     | 
| 
       519 
     | 
    
         
            -
            new Rails 5.1+ app using `--webpack=stimulus` option:
         
     | 
| 
       520 
     | 
    
         
            -
             
     | 
| 
       521 
     | 
    
         
            -
            ```
         
     | 
| 
       522 
     | 
    
         
            -
            # Rails 5.1+
         
     | 
| 
       523 
     | 
    
         
            -
            rails new myapp --webpack=stimulus
         
     | 
| 
       524 
     | 
    
         
            -
            ```
         
     | 
| 
       525 
     | 
    
         
            -
             
     | 
| 
       526 
     | 
    
         
            -
            (or run `bundle exec rails webpacker:install:stimulus` on a Rails app already setup with Webpacker).
         
     | 
| 
       527 
     | 
    
         
            -
             
     | 
| 
       528 
     | 
    
         
            -
            Please read [The Stimulus Handbook](https://stimulusjs.org/handbook/introduction) or learn more about its source code at https://github.com/stimulusjs/stimulus
         
     | 
| 
       529 
     | 
    
         
            -
             
     | 
| 
       530 
     | 
    
         
            -
            ### CoffeeScript
         
     | 
| 
       531 
     | 
    
         
            -
             
     | 
| 
       532 
     | 
    
         
            -
            To add [CoffeeScript](http://coffeescript.org/) support,
         
     | 
| 
       533 
     | 
    
         
            -
            run `bundle exec rails webpacker:install:coffee` on a Rails app already
         
     | 
| 
       534 
     | 
    
         
            -
            setup with Webpacker.
         
     | 
| 
       535 
     | 
    
         
            -
             
     | 
| 
       536 
     | 
    
         
            -
            An example `hello_coffee.coffee` file will also be added to your project
         
     | 
| 
       537 
     | 
    
         
            -
            in `app/javascript/packs` so that you can experiment with CoffeeScript right away.
         
     | 
| 
       538 
     | 
    
         
            -
             
     | 
| 
       539 
     | 
    
         
            -
            ### Erb
         
     | 
| 
       540 
     | 
    
         
            -
             
     | 
| 
       541 
     | 
    
         
            -
            To add [Erb](https://apidock.com/ruby/ERB) support in your JS templates,
         
     | 
| 
       542 
     | 
    
         
            -
            run `bundle exec rails webpacker:install:erb` on a Rails app already
         
     | 
| 
       543 
     | 
    
         
            -
            setup with Webpacker.
         
     | 
| 
       544 
     | 
    
         
            -
             
     | 
| 
       545 
     | 
    
         
            -
            An example `hello_erb.js.erb` file will also be added to your project
         
     | 
| 
       546 
     | 
    
         
            -
            in `app/javascript/packs` so that you can experiment with Erb-flavoured
         
     | 
| 
       547 
     | 
    
         
            -
            javascript right away.
         
     | 
| 
      
 334 
     | 
    
         
            +
            * [React](./docs/integrations.md#React)
         
     | 
| 
      
 335 
     | 
    
         
            +
            * [Angular with TypeScript](./docs/integrations.md#Angular-with-TypeScript)
         
     | 
| 
      
 336 
     | 
    
         
            +
            * [Vue](./docs/integrations.md#Vue)
         
     | 
| 
      
 337 
     | 
    
         
            +
            * [Elm](./docs/integrations.md#Elm)
         
     | 
| 
      
 338 
     | 
    
         
            +
            * [Svelte](./docs/integrations.md#Svelte)
         
     | 
| 
      
 339 
     | 
    
         
            +
            * [Stimulus](./docs/integrations.md#Stimulus)
         
     | 
| 
      
 340 
     | 
    
         
            +
            * [CoffeeScript](./docs/integrations.md#CoffeeScript)
         
     | 
| 
      
 341 
     | 
    
         
            +
            * [Typescript](./docs/integrations.md)
         
     | 
| 
      
 342 
     | 
    
         
            +
            * [Erb](./docs/integrations.md#Erb)
         
     | 
| 
       548 
343 
     | 
    
         | 
| 
      
 344 
     | 
    
         
            +
            See [Integrations](./docs/integrations.md) for further details.
         
     | 
| 
       549 
345 
     | 
    
         | 
| 
       550 
346 
     | 
    
         
             
            ## Paths
         
     | 
| 
       551 
347 
     | 
    
         |