Skip to content

Conversation

justin808
Copy link
Member

  • Added console & error logging
  • Catch exceptions and log them on the server side
  • Issue with HelloWorld component is not loade properly.
    Visit /focused to see the issue
  • Created /focused so that a specific part can be individually tested.
  • Lots of cleanup and refactoring.
  • Consistency with using suffix App for generator functions
  • Added default for generator_function

Replace #19

josiasds and others added 6 commits September 9, 2015 21:00
- Add support to React components generated with React.createClass()
- Add “generator” property to allow creating a React component via a
function
- Add HelloES5 component to the dummy application
- Renaming Ruby variables to snake case
- Make ReactRenderer#render_js_react_element a class method
- Improve generated JS code
* Added console & error logging
* Catch exceptions and log them on the server side
* Issue with HelloWorld component is not loade properly.
  Visit /focused to see the issue
* Created /focused so that a specific part can be individually tested.
* Lots of cleanup and refactoring.
* Consistency with using suffix App for generator functions
* Added default for generator_function
@justin808
Copy link
Member Author

@alexfedoseev @josiasds Please pull this code. I need some help. This is really close, but if you go to http://localhost:3000/focused then you'll see the error which is that the HelloWorld component is not found. This is doing simple client rendering. Same issue server rendering. Thanks.

Also, we added the option for the helper of generator_function. We couldn't figure out a better way to identify the function created by React.createClass vs. our own generator function, and thus, we'll just specify this in the helper.

Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to split definition and export if we don't do anything with exported class?

Copy link
Member Author

Choose a reason for hiding this comment

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

@alexfedoseev We don't need to split. We were experimenting. Voodoo coding.

Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't it be aligned?

index.html.erb crashing

need to put all the example in separate web pages with clear
explanations of what is being demonstrated
* Also catches when generator_function is set to true when it's not a
  generator function.
* Reuse the same catch on both client and server.
* Started to format JS code better.
* Some readme improvements
README.md Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: "these lines to"

@justin808 justin808 changed the title Support direct react components Support direct react components and server console messages and linting Sep 17, 2015
mapreal19 and others added 4 commits September 18, 2015 11:59
# Conflicts:
#	README.md
#	spec/dummy/Gemfile.lock
#	spec/dummy/bin/setup
#	spec/dummy/spec/rails_helper.rb
#	spec/dummy/spec/spec_helper.rb
All tests passing
justin808 added a commit that referenced this pull request Sep 20, 2015
Support direct react components and server console messages and linting
@justin808 justin808 merged commit b7d02c4 into master Sep 20, 2015
@justin808 justin808 deleted the support-direct-react-components branch September 20, 2015 02:35
justin808 added a commit that referenced this pull request Oct 6, 2025
Implements --rspack flag for react_on_rails:install generator to use
Rspack bundler instead of Webpack, providing ~20x faster builds.

## Changes
- Added --rspack option to install_generator.rb and base_generator.rb
- Conditional dependency installation (rspack vs webpack packages)
- Auto-configures shakapacker.yml for rspack with SWC transpiler
- Created bin/switch-bundler utility to switch bundlers post-install

## Key Features
- Rspack packages: @rspack/core, @rspack/cli, @rspack/plugin-react-refresh
- Compatible with --typescript and --redux options
- Reversible via bin/switch-bundler script
- Supports npm, yarn, and pnpm package managers

## Usage
rails generate react_on_rails:install --rspack
bin/switch-bundler rspack  # Switch existing app

Based on patterns from react_on_rails-demos PR #20

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
justin808 added a commit that referenced this pull request Oct 7, 2025
Implements unified configuration approach where the same webpack config
files work with both webpack and rspack bundlers, based on the
assets_bundler setting in shakapacker.yml.

## Changes

**development.js.tt**:
- Add config import from shakapacker to access assets_bundler setting
- Conditional React Refresh plugin loading:
  - Rspack: @rspack/plugin-react-refresh
  - Webpack: @pmmmwh/react-refresh-webpack-plugin
- Prevents "window not found" errors when using rspack

**serverWebpackConfig.js.tt**:
- Replace hardcoded webpack require with bundler variable
- Bundler conditionally requires @rspack/core or webpack
- Use bundler.optimize.LimitChunkCountPlugin instead of webpack-specific
- Eliminates warnings about webpack when using rspack

**RSPACK_IMPLEMENTATION.md**:
- Document webpack config template changes
- Explain unified configuration approach

## Benefits

- Single set of config files works for both bundlers
- No warnings when using rspack about webpack.config.js
- Seamless switching between bundlers via bin/switch-bundler
- Follows pattern from react_on_rails-demos PR #20

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
justin808 added a commit that referenced this pull request Oct 7, 2025
Implements --rspack flag for react_on_rails:install generator to use
Rspack bundler instead of Webpack, providing ~20x faster builds.

## Changes
- Added --rspack option to install_generator.rb and base_generator.rb
- Conditional dependency installation (rspack vs webpack packages)
- Auto-configures shakapacker.yml for rspack with SWC transpiler
- Created bin/switch-bundler utility to switch bundlers post-install

## Key Features
- Rspack packages: @rspack/core, @rspack/cli, @rspack/plugin-react-refresh
- Compatible with --typescript and --redux options
- Reversible via bin/switch-bundler script
- Supports npm, yarn, and pnpm package managers

## Usage
rails generate react_on_rails:install --rspack
bin/switch-bundler rspack  # Switch existing app

Based on patterns from react_on_rails-demos PR #20

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
justin808 added a commit that referenced this pull request Oct 7, 2025
Implements unified configuration approach where the same webpack config
files work with both webpack and rspack bundlers, based on the
assets_bundler setting in shakapacker.yml.

## Changes

**development.js.tt**:
- Add config import from shakapacker to access assets_bundler setting
- Conditional React Refresh plugin loading:
  - Rspack: @rspack/plugin-react-refresh
  - Webpack: @pmmmwh/react-refresh-webpack-plugin
- Prevents "window not found" errors when using rspack

**serverWebpackConfig.js.tt**:
- Replace hardcoded webpack require with bundler variable
- Bundler conditionally requires @rspack/core or webpack
- Use bundler.optimize.LimitChunkCountPlugin instead of webpack-specific
- Eliminates warnings about webpack when using rspack

**RSPACK_IMPLEMENTATION.md**:
- Document webpack config template changes
- Explain unified configuration approach

## Benefits

- Single set of config files works for both bundlers
- No warnings when using rspack about webpack.config.js
- Seamless switching between bundlers via bin/switch-bundler
- Follows pattern from react_on_rails-demos PR #20

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
justin808 added a commit that referenced this pull request Oct 9, 2025
Implements --rspack flag for react_on_rails:install generator to use
Rspack bundler instead of Webpack, providing ~20x faster builds.

## Changes
- Added --rspack option to install_generator.rb and base_generator.rb
- Conditional dependency installation (rspack vs webpack packages)
- Auto-configures shakapacker.yml for rspack with SWC transpiler
- Created bin/switch-bundler utility to switch bundlers post-install

## Key Features
- Rspack packages: @rspack/core, @rspack/cli, @rspack/plugin-react-refresh
- Compatible with --typescript and --redux options
- Reversible via bin/switch-bundler script
- Supports npm, yarn, and pnpm package managers

## Usage
rails generate react_on_rails:install --rspack
bin/switch-bundler rspack  # Switch existing app

Based on patterns from react_on_rails-demos PR #20

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
justin808 added a commit that referenced this pull request Oct 9, 2025
Implements unified configuration approach where the same webpack config
files work with both webpack and rspack bundlers, based on the
assets_bundler setting in shakapacker.yml.

## Changes

**development.js.tt**:
- Add config import from shakapacker to access assets_bundler setting
- Conditional React Refresh plugin loading:
  - Rspack: @rspack/plugin-react-refresh
  - Webpack: @pmmmwh/react-refresh-webpack-plugin
- Prevents "window not found" errors when using rspack

**serverWebpackConfig.js.tt**:
- Replace hardcoded webpack require with bundler variable
- Bundler conditionally requires @rspack/core or webpack
- Use bundler.optimize.LimitChunkCountPlugin instead of webpack-specific
- Eliminates warnings about webpack when using rspack

**RSPACK_IMPLEMENTATION.md**:
- Document webpack config template changes
- Explain unified configuration approach

## Benefits

- Single set of config files works for both bundlers
- No warnings when using rspack about webpack.config.js
- Seamless switching between bundlers via bin/switch-bundler
- Follows pattern from react_on_rails-demos PR #20

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants