-
Notifications
You must be signed in to change notification settings - Fork 613
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
Project Utils: Build App SSR source files shouldn't be hard coded #1218
Comments
@latotty you could approach it in more than 1 way, that's why we have The built-in SSR setup is very basic, but works for 95% of cases. If you're willing to send another PR with your improvements, that would be great! 👍 |
@Pavel910 Sure thing! I saw the I used |
@latotty sure, let's expand the options. I think we don't need the extra await buildAppSSR(
{
...options,
app: __dirname,
indexHtmlPath: path.resolve(__dirname, "build", "index.html"),
createAppPath: path.resolve(__dirname, "src", "create-app")
},
context
); Feel free to add more options if you find them useful :) |
This is:
Specifications
Expected Behavior
When I set up SSR for site, I would like to define where the index.html and the appComponent factory is located.
Actual Behavior
Currently it is hard coded to "./build/index.html" and "./src/App".
Detailed Description
In my codebase I structured the code differently, I separated the createApp from the App file. And I also use kebab case.
And I would like to use the provided SSR bundler instead of my custom one.
Possible Solution
In my codebase, I 'forked' the current SSR bundler into a package, and added an option to provide the file paths optionally.
Example:
I replaced the:
webiny-js/packages/project-utils/bundling/ssr/buildAppSSR.js
Lines 15 to 16 in 7f30544
With:
And added ssrOptions to the args:
I think this could be handled more elegantly 😉
I prefer named exports, but I think for this use-case (bundling) default exporting the factory function is more convenient.
The text was updated successfully, but these errors were encountered: