- Notifications
You must be signed in to change notification settings - Fork 378
Update react_on_rails to v16.1.1 #654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
13 commits Select commit Hold shift + click to select a range
f642b64 Upgrade React on Rails from 14.2.1 to 16.0.1.rc.2
justin808 ef76635 Update react_on_rails to v16.1.1
justin808 d35babe Apply react_on_rails:install generator updates
justin808 ac9f94b Revert changes to initializer, webpack files, and rspec config for mi…
justin808 53edddd Revert shakapacker.yml changes to keep PR minimal
justin808 d0b800b Revert .gitignore changes for minimal PR
justin808 dc78c41 Remove Procfile.dev-prod-assets for minimal PR
justin808 a39613a Revert bin/dev changes for minimal PR
justin808 3e0c88b Restore Procfile.dev-prod-assets - file exists on master
justin808 20e6d4c Restore improved bin/dev from generator
justin808 f6d8328 Fix Sass legacy JS API deprecation warnings
justin808 817eed8 Improve sass-loader modern API configuration
justin808 ba04c6c Add missing newlines at end of webpack config files
justin808 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Apply react_on_rails:install generator updates
Ran the react_on_rails:install generator to get latest v16.1.1 improvements: - Enhanced bin/dev script with better development server management - Added Procfile variations for different development modes: - Procfile.dev: HMR mode with webpack-dev-server - Procfile.dev-static-assets: Watch mode without HMR - Procfile.dev-prod-assets: Development with production assets - Updated webpack configurations for v16.1.1 compatibility - Updated shakapacker.yml configuration - Updated babel.config.js - Updated react_on_rails initializer - Added generateWebpackConfigs.js helper These updates provide better development experience and align with React on Rails v16.1.1 best practices. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Loading branch information
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,36 @@ | ||
| // The source code including full typescript support is available at: | ||
| // https://github.com/shakacode/react_on_rails_demo_ssr_hmr/blob/master/babel.config.js | ||
| | ||
| module.exports = function (api) { | ||
| const defaultConfigFunc = require('shakapacker/package/babel/preset.js'); | ||
| const resultConfig = defaultConfigFunc(api); | ||
| const isProductionEnv = api.env('production'); | ||
| const defaultConfigFunc = require('shakapacker/package/babel/preset.js') | ||
| const resultConfig = defaultConfigFunc(api) | ||
| const isProductionEnv = api.env('production') | ||
| | ||
| const changesOnDefault = { | ||
| presets: [ | ||
| [ | ||
| '@babel/preset-react', | ||
| { | ||
| runtime: 'automatic', | ||
| development: !isProductionEnv, | ||
| useBuiltIns: true, | ||
| }, | ||
| ], | ||
| runtime: 'automatic' | ||
| } | ||
| ] | ||
| ].filter(Boolean), | ||
| plugins: [ | ||
| process.env.WEBPACK_SERVE && 'react-refresh/babel', | ||
| isProductionEnv && [ | ||
| 'babel-plugin-transform-react-remove-prop-types', | ||
| // Enable React Refresh (Fast Refresh) only when webpack-dev-server is running (HMR mode) | ||
| // This prevents React Refresh from trying to connect when using static compilation | ||
| !isProductionEnv && process.env.WEBPACK_SERVE && 'react-refresh/babel', | ||
| isProductionEnv && ['babel-plugin-transform-react-remove-prop-types', | ||
| { | ||
| removeImport: true, | ||
| }, | ||
| ], | ||
| removeImport: true | ||
| } | ||
| ] | ||
| ].filter(Boolean), | ||
| }; | ||
| } | ||
| | ||
| resultConfig.presets = [...resultConfig.presets, ...changesOnDefault.presets]; | ||
| resultConfig.plugins = [...resultConfig.plugins, ...changesOnDefault.plugins]; | ||
| resultConfig.presets = [...resultConfig.presets, ...changesOnDefault.presets] | ||
| resultConfig.plugins = [...resultConfig.plugins, ...changesOnDefault.plugins ] | ||
| | ||
| return resultConfig; | ||
| }; | ||
| return resultConfig | ||
| } |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,84 +1,67 @@ | ||
| # frozen_string_literal: true | ||
| | ||
| # Shown below are the defaults for configuration | ||
| ReactOnRails.configure do |config| | ||
| # Define the files for we need to check for webpack compilation when running tests | ||
| config.webpack_generated_files = %w[client-bundle.js server-bundle.js] | ||
| # See https://github.com/shakacode/react_on_rails/blob/master/docs/guides/configuration.md | ||
| # for many more options. | ||
| | ||
| config.build_test_command = "RAILS_ENV=test bin/shakapacker" | ||
| config.build_production_command = "RAILS_ENV=production NODE_ENV=production bin/shakapacker" | ||
| ReactOnRails.configure do |config| | ||
| # This configures the script to run to build the production assets by webpack. Set this to nil | ||
| # if you don't want react_on_rails building this file for you. | ||
| # If nil, then the standard shakacode/shakapacker assets:precompile will run | ||
| # config.build_production_command = nil | ||
| | ||
| # This is the file used for server rendering of React when using `(prerender: true)` | ||
| # If you are never using server rendering, you may set this to "". | ||
| # If you are using the same file for client and server rendering, having this set probably does | ||
| # not affect performance. | ||
| config.server_bundle_js_file = "server-bundle.js" | ||
| ################################################################################ | ||
| ################################################################################ | ||
| # TEST CONFIGURATION OPTIONS | ||
| # Below options are used with the use of this test helper: | ||
| # ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config) | ||
| ################################################################################ | ||
| | ||
| # React on Rails 16 compatibility: Workaround for removed error handling | ||
| # If you are using this in your spec_helper.rb (or rails_helper.rb): | ||
| # | ||
| # ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config) | ||
| # | ||
| # BREAKING CHANGE in v16: React on Rails 14.2.1 had robust error handling that would | ||
| # fallback to the Shakapacker output path when bundle lookup failed. This was removed | ||
| # in v16.0.1.rc.2, causing it to look in the wrong directory during tests. | ||
| # with rspec then this controls what npm command is run | ||
| # to automatically refresh your webpack assets on every test run. | ||
| # | ||
| # This configuration tells React on Rails where to find bundles in test environment. | ||
| # Without this, it defaults to public/webpack/test/ instead of public/packs/ | ||
| config.generated_assets_dir = Rails.public_path.join("packs").to_s if Rails.env.test? | ||
| # Alternately, you can remove the `ReactOnRails::TestHelper.configure_rspec_to_compile_assets` | ||
| # and set the config/shakapacker.yml option for test to true. | ||
| config.build_test_command = "RAILS_ENV=test bin/shakapacker" | ||
| | ||
| ################################################################################ | ||
| # CLIENT RENDERING OPTIONS | ||
| # Below options can be overriden by passing options to the react_on_rails | ||
| # `render_component` view helper method. | ||
| ################################################################################ | ||
| | ||
| # Default is false. Can be overriden at the component level. | ||
| # Set to false for debugging issues before turning on to true. | ||
| config.prerender = true | ||
| | ||
| # default is true for development, off otherwise | ||
| config.trace = Rails.env.development? | ||
| | ||
| ################################################################################ | ||
| # SERVER RENDERING OPTIONS | ||
| # Applicable options can be overriden by passing options to the react_on_rails | ||
| # `render_component` view helper method. | ||
| ################################################################################ | ||
| # This is the file used for server rendering of React when using `(prerender: true)` | ||
| # If you are never using server rendering, you should set this to "". | ||
| # Note, there is only one server bundle, unlike JavaScript where you want to minimize the size | ||
| # of the JS sent to the client. For the server rendering, React on Rails creates a pool of | ||
| # JavaScript execution instances which should handle any component requested. | ||
| # | ||
| # While you may configure this to be the same as your client bundle file, this file is typically | ||
| # different. You should have ONE server bundle which can create all of your server rendered | ||
| # React components. | ||
| # | ||
| config.server_bundle_js_file = "server-bundle.js" | ||
| | ||
| # If set to true, this forces Rails to reload the server bundle if it is modified | ||
| config.development_mode = Rails.env.development? | ||
| | ||
| # For server rendering. This can be set to false so that server side messages are discarded. | ||
| # Default is true. Be cautious about turning this off. | ||
| config.replay_console = true | ||
| | ||
| # Default is true. Logs server rendering messages to Rails.logger.info | ||
| config.logging_on_server = true | ||
| | ||
| # Change to true to raise exception on server if the JS code throws. Let's do this only if not | ||
| # in production, as the JS code might still work on the client and we don't want to blow up the | ||
| # whole Rails page. | ||
| config.raise_on_prerender_error = !Rails.env.production? | ||
| # Configure where server bundles are output. Defaults to "ssr-generated". | ||
| # This should match your webpack configuration for server bundles. | ||
| config.server_bundle_output_path = "ssr-generated" | ||
| | ||
| # Server rendering only (not for render_component helper) | ||
| # You can configure your pool of JS virtual machines and specify where it should load code: | ||
| # On MRI, use `therubyracer` for the best performance | ||
| # (see [discussion](https://github.com/reactjs/react-rails/pull/290)) | ||
| # On MRI, you'll get a deadlock with `pool_size` > 1 | ||
| # If you're using JRuby, you can increase `pool_size` to have real multi-threaded rendering. | ||
| config.server_renderer_pool_size = 1 # increase if you're on JRuby | ||
| config.server_renderer_timeout = 20 # seconds | ||
| # Enforce that server bundles are only loaded from private (non-public) directories. | ||
| # When true, server bundles will only be loaded from the configured server_bundle_output_path. | ||
| # This is recommended for production to prevent server-side code from being exposed. | ||
| config.enforce_private_server_bundles = true | ||
| | ||
| ################################################################################ | ||
| # I18N OPTIONS | ||
| ################################################################################ | ||
| # Replace the following line to the location where you keep translation.js & default.js. | ||
| config.i18n_dir = Rails.root.join("client/app/libs/i18n") | ||
| | ||
| ################################################################################ | ||
| # MISCELLANEOUS OPTIONS | ||
| # FILE SYSTEM BASED COMPONENT REGISTRY | ||
| ################################################################################ | ||
| | ||
| # This allows you to add additional values to the Rails Context. Implement one static method | ||
| # called `custom_context(view_context)` and return a Hash. | ||
| config.rendering_extension = nil | ||
| config.i18n_output_format = "js" | ||
| # `components_subdirectory` is the name of the matching directories that contain automatically registered components | ||
| # for use in the Rails views. The default is nil, you can enable the feature by updating it in the next line. | ||
| config.components_subdirectory = "ror_components" | ||
| # | ||
| # For automated component registry, `render_component` view helper method tries to load bundle for component from | ||
| # generated directory. default is false, you can pass option at the time of individual usage or update the default | ||
| # in the following line | ||
| config.auto_load_bundle = true | ||
| end |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.