Closed dac09 closed 2 years ago
Thanks for the report, looking into this!
Pushed v3.0.0-beta.22
to npm now, should be fixed.
Before we do the final v3.0.0 release, it should have gotten a TypeScript definition for the configuration and tests to make sure this type of problem doesn't happen again. Cheers.
One thing to know though: clientModule
expects an absolute path based on the root
invite.config.js
.
So if root
in vite.config.js
is join(<dirname>, 'client')
, and your client module is client/foobar.js
:
{
clientModule: '/foobar.js'
}
And also, you'll have to change the path in your server vite build
call in package.json
.
Additional bit of info, the following properties can be set either at the configuration top-level or in renderer
. If they're set in renderer
, they take precedence over anything you've set at the top-level.
clientModule
createErrorHandler
createHtmlFunction
createHtmlTemplateFunction
createRenderFunction
createRoute
createRouteHandler
prepareClient
One thing to know though: clientModule expects an absolute path based on the root invite.config.js.
Useful to know, and thanks for the quick fix @galvez. Can confirm it is now working.
I wonder if it would be possible to use an absolute path instead? What I'm trying to evaluate is whether I can move the clientModule to inside the framework i.e. generate the routes, and hideaway clientModule from the user all together.
I suppose I can always generate the file in a "ignored" folder `.redwood/generatedClientModule.js' and point to it from the vite root.
hideaway clientModule from the user all together.
See https://github.com/fastify/vite-plugin-blueprint — personally I've moved away from this approach because I want to keep fastify-vite and fastify-dx fully transparent, but I might still revisit this.
In any case, vite-plugin-blueprint
is what you need.
Prerequisites
Fastify version
3.29.0
Plugin version
3.0.0-beta.21
Node.js version
v16.13.1
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
12.3.1
Description
I would like to override the default path of clientModule - the first problem is that the documentation is a little difficult to understand - especially with no TypeScript. Perhaps it would be better to have an example showing where the config object is passed (i.e. its hard to tell whether we configure the vite plugin, or the fastify plugin).
And second, even when I supply clientModule, it seems to error out:
when passing it inside the render object (1):
and when passed outside (2):
It doesn't matter whether this path is correct or not
createApp
functionSteps to Reproduce
client/index.js
toclient/clientModule.js
in the React hydration exampleyarn dev
Expected Behavior