Feature : Possibility to change the source code folder #25
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.
Actual Files Organisation and objectif
The actual organisation of the repo is the following
This files and folders organisation merge config files with source folders. My intention is to be able to add a folder level for source code like this
This way we can more clearly add comlexity in source code organisation with hooks, pages, utils, middleware and all other usefull folders for stronger file organisation.
The limitations
Today the "components" folder is locked at this place in the folder structure because it is hardcoded. Some workaround are kind of possible but i don't think that having a dependencies forcing a specific folder structure is a good thing.
The approch
The idea is quit simple, keep the hardcoded "components" folder to not bring breaking changes, but adding an option to change it. The impact on the code should be minimal.
The Results
No changes in reaxt-exemple
No errors in the terminal or browser console
Rename "components" folder to "src"
Obviously we have an error in the terminal
Reaxt use the default configuration and is looking for "components" folder
Rename + Reaxt config
To add the config, we need to give
Reaxt.render!
thesrc_folder
option.Exemple :
From here it can works, depends on your previous JS implementation of
reaxt_server_render
.If the terminal doesn't show any errors but your webpage is broken and browser console say:
Uncaught (in promise) Error: Cannot find module './components/App'
That means that in the JS part, the component given in the callback function of
reaxt_server_render
doesn't have any props, and the component should have at least thesrc_folder
as prop from the first agument.Exemple:
After that the implementation should be complete without any errors in the temrinal or browser console.
Troubleshooting
Please refer to the Result section with the possible bugs explained