Replies: 1 comment
-
Yes, it’s possible to add another dev directory inside the /app folder in a React-Rails application, but it depends on your specific use case. Here’s a general overview of how you might approach it: Creating the Directory: You can add a new directory under /app by simply creating an app/dev folder. This is useful for organizing files or components specific to your development environment, like development-only React components, utilities, or test helpers. Configuring Webpack (if you're using it): If the dev directory contains JavaScript files or React components, you may need to update your Webpack configuration (if custom-configured) to ensure it compiles assets from this new directory. Rails Autoload Paths: By default, Rails autoloads certain directories within /app like /app/models, /app/controllers, and /app/helpers. If you need Rails to load Ruby files from the dev directory automatically, you can configure it by adding this line to your config/application.rb: ruby React-Rails Integration: If you're using React components in this dev directory and you want Rails to recognize them, make sure the paths are accessible. The react-rails gem will load components based on what is available to the asset pipeline or Webpack configuration. |
Beta Was this translation helpful? Give feedback.
-
I am migrating our codebase to Typescript and want new code to be written in a new directory: app/typescript. Note: I don't need any SSR, typical SPA behavior is sufficient. It would be nice to be able to configure bundle splitting (like with app/javascript/packs)...
I am very new to the entire RoR ecosystem and thus it's tough for me to pinpoint where I want to look for making changes.
Would anyone be able to help me out here? Is what I want even possible?
In any case: Thx for all the resources you guys invest in making RoR development approachable for people with vastly different backgrounds (React etc.), really appreciated :)
Best, Sam
Beta Was this translation helpful? Give feedback.
All reactions