Skip to content

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#855
jonathanphilippou wants to merge 2 commits intoshakacode:masterfrom
jonathanphilippou:docs-for-upgrading

Conversation

@jonathanphilippou
Copy link
Copy Markdown
Contributor

@jonathanphilippou jonathanphilippou commented May 29, 2017

@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 Reviewable

@coveralls
Copy link
Copy Markdown

coveralls commented May 29, 2017

Coverage Status

Coverage remained the same at 98.007% when pulling 2edef5a on Conturbo:docs-for-upgrading into 3c70914 on shakacode:master.

@justin808
Copy link
Copy Markdown
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.
Copy link
Copy Markdown
Contributor Author

@jonathanphilippou jonathanphilippou May 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.
Copy link
Copy Markdown
Contributor Author

@jonathanphilippou jonathanphilippou May 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justin808 check step 3


```

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:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything from here on is the same as before.

@justin808
Copy link
Copy Markdown
Member

@Conturbo This will need revisiting soon. Refer to #835

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants