Sha256: dd018025efb49ef796460da7c1f9fc8b5015c5014a3487dcd02658c7215bbcb0

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

# To webpacker v6 from v5

This guide aims to help you migrating to webpacker 6. If you are using
vanilla webpacker install then hopefully, the upgrade should be really
straightforward.

## Preparation

- Rename `config/webpack` to `config/webpack_old`
- Rename `config/webpacker.yml` to `config/webpacker_old.yml`
- Upgrade webpacker

  ```ruby
  # Gemfile
  gem 'webpacker', '~> 6.x'
  ```

  ```
  bundle
  ```

  ```bash
  yarn add @rails/webpacker@next
  ```

  ```bash
  bundle exec rails webpacker:install
  ```

- Change `javascript_pack_tag` and `stylesheet_pack_tag` to `javascript_packs_with_chunks_tag` and
  `stylesheet_packs_with_chunks_tag`

- If you are using any integrations like css, react or typescript. Please see https://github.com/rails/webpacker#integrations section on how they work in v6.0

- Copy over any custom webpack config from `config/webpack_old`

  ```js
  // config/webpack/base.js
  const { webpackConfig, merge } = require('@rails/webpacker')
  const customConfig = require('./custom')

  module.exports = merge(webpackConfig, customConfig)
  ```

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webpacker-6.0.0.beta.2 6_0_upgrade.md
webpacker-6.0.0.beta.1 6_0_upgrade.md
webpacker-6.0.0.beta 6_0_upgrade.md