Skip to content

Commit 7dae4ea

Browse files
justin808claude
andcommitted
Remove PropTypes and fix webpack CSS configuration
- Remove deprecated PropTypes from all HelloWorld component templates - Fix testing setup indentation to match other sections - Revert commonWebpackConfig.js.tt to original simple version - Let Shakapacker handle CSS modules through built-in configuration This modernizes generated components for React 19 compatibility and fixes build issues with static/prod modes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 3549506 commit 7dae4ea

File tree

5 files changed

+5
-40
lines changed

5 files changed

+5
-40
lines changed

lib/generators/react_on_rails/generator_messages.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ def build_testing_section
112112
<<~TESTING
113113
114114
115-
🧪 TESTING SETUP (Optional):
116-
─────────────────────────────────────────────────────────────────────────
117-
For JavaScript testing with asset compilation, add this to your RSpec config:
115+
🧪 TESTING SETUP (Optional):
116+
─────────────────────────────────────────────────────────────────────────
117+
For JavaScript testing with asset compilation, add this to your RSpec config:
118118
119-
# In spec/rails_helper.rb or spec/spec_helper.rb:
120-
ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)
119+
# In spec/rails_helper.rb or spec/spec_helper.rb:
120+
ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)
121121
TESTING
122122
end
123123

lib/generators/react_on_rails/templates/base/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import PropTypes from 'prop-types';
21
import React, { useState } from 'react';
32
import * as style from './HelloWorld.module.css';
43

@@ -19,8 +18,4 @@ const HelloWorld = (props) => {
1918
);
2019
};
2120

22-
HelloWorld.propTypes = {
23-
name: PropTypes.string.isRequired, // this is passed from the Rails view
24-
};
25-
2621
export default HelloWorld;

lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import PropTypes from 'prop-types';
21
import React, { useState } from 'react';
32
import * as style from './HelloWorld.module.css';
43

@@ -19,8 +18,4 @@ const HelloWorld = (props) => {
1918
);
2019
};
2120

22-
HelloWorld.propTypes = {
23-
name: PropTypes.string.isRequired, // this is passed from the Rails view
24-
};
25-
2621
export default HelloWorld;

lib/generators/react_on_rails/templates/base/base/config/webpack/commonWebpackConfig.js.tt

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,13 @@
22

33
// Common configuration applying to client and server configuration
44
const { generateWebpackConfig, merge } = require('shakapacker');
5-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
65

76
const baseClientWebpackConfig = generateWebpackConfig();
87

98
const commonOptions = {
109
resolve: {
1110
extensions: ['.css', '.ts', '.tsx'],
1211
},
13-
module: {
14-
rules: [
15-
{
16-
test: /\.module\.css$/i,
17-
use: [
18-
process.env.NODE_ENV === 'development' ? 'style-loader' : MiniCssExtractPlugin.loader,
19-
{
20-
loader: 'css-loader',
21-
options: {
22-
modules: {
23-
localIdentName: '[name]__[local]__[hash:base64:5]',
24-
},
25-
},
26-
},
27-
],
28-
},
29-
],
30-
},
3112
};
3213

3314
// Copy the object using merge b/c the baseClientWebpackConfig and commonOptions are mutable globals

lib/generators/react_on_rails/templates/redux/base/app/javascript/bundles/HelloWorld/components/HelloWorld.jsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import PropTypes from 'prop-types';
21
import React from 'react';
32

43
const HelloWorld = ({ name, updateName }) => (
@@ -17,9 +16,4 @@ const HelloWorld = ({ name, updateName }) => (
1716
</div>
1817
);
1918

20-
HelloWorld.propTypes = {
21-
name: PropTypes.string.isRequired,
22-
updateName: PropTypes.func.isRequired,
23-
};
24-
2519
export default HelloWorld;

0 commit comments

Comments
 (0)