-
-
Notifications
You must be signed in to change notification settings - Fork 638
Fix bundle path resolution and improve server bundle security #1798
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
Changes from 29 commits
4ee772e
9e1465a
7aff6da
b0c4963
61a1254
d974d82
60b50d8
6a2035f
afd06ed
ed37a2b
fa07c57
55a30c0
8936a77
88212b8
d917bda
b478d61
3cb7cdc
60d498d
3d5c7ea
4252368
6c38c6f
a9aff90
92b58ea
ffa58ac
369f5a7
b36413d
a0e9656
1c9e45e
57a3ab9
eb7ed67
fcddead
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,7 +24,7 @@ def add_hello_world_route | |||||||||||||
| end | ||||||||||||||
|
|
||||||||||||||
| def create_react_directories | ||||||||||||||
| # Create auto-registration directory structure for non-Redux components only | ||||||||||||||
| # Create auto-bundling directory structure for non-Redux components only | ||||||||||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AbanoubGhadban note the name consistency. |
||||||||||||||
| # Redux components handle their own directory structure | ||||||||||||||
| return if options.redux? | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -136,14 +136,17 @@ def update_gitignore_for_auto_registration | |||||||||||||
| return unless File.exist?(gitignore_path) | ||||||||||||||
|
|
||||||||||||||
| gitignore_content = File.read(gitignore_path) | ||||||||||||||
| return if gitignore_content.include?("**/generated/**") | ||||||||||||||
|
|
||||||||||||||
| append_to_file ".gitignore" do | ||||||||||||||
| <<~GITIGNORE | ||||||||||||||
| additions = [] | ||||||||||||||
| additions << "**/generated/**" unless gitignore_content.include?("**/generated/**") | ||||||||||||||
| additions << "ssr-generated" unless gitignore_content.include?("ssr-generated") | ||||||||||||||
|
|
||||||||||||||
| return if additions.empty? | ||||||||||||||
|
|
||||||||||||||
| # Generated React on Rails packs | ||||||||||||||
| **/generated/** | ||||||||||||||
| GITIGNORE | ||||||||||||||
| append_to_file ".gitignore" do | ||||||||||||||
| lines = ["\n# Generated React on Rails packs"] | ||||||||||||||
| lines.concat(additions) | ||||||||||||||
| "#{lines.join("\n")}\n" | ||||||||||||||
|
Comment on lines
+147
to
+149
|
||||||||||||||
| lines = ["\n# Generated React on Rails packs"] | |
| lines.concat(additions) | |
| "#{lines.join("\n")}\n" | |
| lines = ["# Generated React on Rails packs"] | |
| lines.concat(additions) | |
| lines.join("\n") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,13 +44,14 @@ const configureServer = () => { | |
|
|
||
| // Custom output for the server-bundle that matches the config in | ||
| // config/initializers/react_on_rails.rb | ||
| // Server bundles are output to a private directory (not public) for security | ||
| serverWebpackConfig.output = { | ||
| filename: 'server-bundle.js', | ||
| globalObject: 'this', | ||
| // If using the React on Rails Pro node server renderer, uncomment the next line | ||
| // libraryTarget: 'commonjs2', | ||
| path: config.outputPath, | ||
| publicPath: config.publicPath, | ||
| path: require('path').resolve(__dirname, '../../ssr-generated'), | ||
|
||
| // No publicPath needed since server bundles are not served via web | ||
| // https://webpack.js.org/configuration/output/#outputglobalobject | ||
| }; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@claude Need to add comment that these js bundles are never hashed.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude finished @justin808's task —— View job
I'll analyze this and get back to you.