Docs for Upgrading from 7.0.4 to 8.0.0#855
Closed
jonathanphilippou wants to merge 2 commits intoshakacode:masterfrom
jonathanphilippou:docs-for-upgrading
Closed
Docs for Upgrading from 7.0.4 to 8.0.0#855jonathanphilippou wants to merge 2 commits intoshakacode:masterfrom jonathanphilippou:docs-for-upgrading
jonathanphilippou wants to merge 2 commits intoshakacode:masterfrom
jonathanphilippou:docs-for-upgrading
Conversation
Member
|
@Conturbo what's the status of this one? |
| }, | ||
| ``` | ||
|
|
||
| 7. You'll also need to configure webpack to use your manifest appropriately. You'll need to configure webpack to knows your manifest's location and so on. |
Contributor
Author
There was a problem hiding this comment.
@justin808 Everything from here-on is still WIP. Generally, we need to explain how to configure webpack using react_on_rails's handy webpackConfigLoader. Most of it wasn't touched. The instructions for step 7 are incomplete and a little broken up.
|
|
||
| ```ruby | ||
| gem 'react_on_rails', '~> 8.0.0.beta.3' | ||
| 1. The webpacker_lite gem generates its webpack assets in the public directory. Thus, you will need to configure your generated assets directory so that they match up with webpacker_lite. |
Contributor
Author
There was a problem hiding this comment.
@justin808 check that step 1 makes sense
| ``` | ||
| config.generated_assets_dir = File.join(%w(public webpack)) | ||
| ``` | ||
| 2. Every time you run your app, webpacker_lite will generate fresh assets/webpack-bundles. Thus, every time you run your app, you'll want to make sure you remove any previously generated webpack assets from your `/public` directory. In general, you can simply remove your `/public/webpack` directory entirely on each run, or you can simply remove the assets for your current environment in case you're running your app in two environments at once, such as test *and* development. |
Contributor
Author
There was a problem hiding this comment.
@justin808 check that step 2 makes sense
| ``` | ||
| rails-client-assets: rm -rf public/webpack/development || true && bundle exec rake react_on_rails:locale && yarn run build:dev:client | ||
| ``` | ||
| 3. In webpacker_lite, a .yml file called `config/webpacker_lite.yml` is used to configure webpack's manifest. Thus, you'll want to create a file in your `/config` directory called `webpacker_lite.yml`. You'll want to configure it so that it creates a webpack manifest. Your manifest should be a .json file, typically called `manifest.json`. In `webpacker_lite.yml` you'll also need to configure which directory to put your webpack assets in. To keep things simple for you, here are some example contents of a typical `config/webpacker_lite.yml` file that would be generated for you by the react_on_rails generator. You can just copy/paste if this suits your needs: |
|
|
||
| ``` | ||
|
|
||
| 4. You'll want to make sure you remove any references to your webpack bundles from any files in your asset pipeline. For example, a common reference you might have is a line in your `assets/javascripts/application.js` like the one shown below: |
Contributor
Author
There was a problem hiding this comment.
check step 4
| //= require webpack-bundle | ||
| ``` | ||
|
|
||
| 5. You'll need to add the approrpriate webpacker_lite helpers to your layouts to load the files from your public deployment directory. The helpers ensure that the bundle names are converted to the correct paths on your rails server. |
Contributor
Author
There was a problem hiding this comment.
check step 5
| <%= javascript_pack_tag 'main' %> | ||
| ``` | ||
|
|
||
| 6. You'll need to configure your webpack-bundle files so that they are placed into your public directory and skip the asset pipeline. For example, you may have some javascript file in your client directory called something like `webpack.config.js`. This webpack config file should have some output code that dictates what path your webpack-bundles are placed into. For example, a change to your code might look something like this: |
Contributor
Author
There was a problem hiding this comment.
check step 6
|
|
||
| Your manifest will be a key-value pairing that maps generic webpack-bundle filenames to fingerprinted filenames. Thus, you'll want to configure webpack to use the manifest so t | ||
|
|
||
| ## Update Your `webpack.config.js` |
Contributor
Author
There was a problem hiding this comment.
Everything from here on is the same as before.
Member
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@justin808 upgrade-to-version-8-0-0.md explains how someone can upgrade their app. It's been tested on scratch-app.
This change is