Sha256: 0889081423e665b206bc6c0fa57efa93396b4c46d13d909e173549b581e34867

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 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

1. If your `source_path` is `app/javascript`, rename it to `app/packs`
2. If your `source_entry_path` is `app/javascript/packs`, rename it to `app/packs/entrypoints`
3. Rename `config/webpack` to `config/webpack_old`
4. Rename `config/webpacker.yml` to `config/webpacker_old.yml`
5. Uninstall the current version of `webpack-dev-server`: `yarn remove webpack-dev-server`
6. Upgrade webpacker

  ```ruby
  # Gemfile
  gem 'webpacker', '~> 6.0.0.pre.2'
  ```

  ```bash
  bundle install
  ```

  ```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`

7. 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.

8. 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)
  ```

9. Copy over custom browserlist config from `.browserlistrc` if it exists into the `"browserlist"` key in `package.json` and remove `.browserslistrc`.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webpacker-6.0.0.beta.4 6_0_upgrade.md
webpacker-6.0.0.beta.3 6_0_upgrade.md