I need some guidance.
Say all I do is create a redwood app with a single page:
yarn create redwood-app ./onepage
yarn rw g page home /
yarn rw g page about
Now I want to get the code for that page so I can put it into a source code box like this which supports javascript:
So I build the website:
yarn rw build web
√ Cleaning Web…
√ Cleaning Web…
√ Building Web…
√ Prerendering Web…
the ./web/dist/index.html the code is:
<!doctype html>
When I open index.html with Chrome , I get nothing. There’s also a ./web/dist/200.html with the exact same above code, but it also opens nothing.
I think the reason I’m getting nothing is because the runtime and app javascript needs to talk to node and react running on the server, correct? Assuming yes, this is where I need help/guidance on how to make a redwood site work in a box like this as I’m not sure what I should be trying to do to get it to work. All I’m really trying to do is get a database driven form designed in redwood (something kind like in the rw tutorial with toaster and pattern validation), but one thing at a time.
I checked out:
and am wondering if the HTML pages spit out by the prerender is the best I can hope for in terms of what I can hope to get out of redwood for html form source code. Even if you disable the api database stuff, you still need a server running react/node or nothing shows. I’m curious if the serverless deploy would get me what I need? Any ideas?
Also:
As you can see, I can’t use any external links, even if I had javascript that didn’t need to be on a server running react/node, I still need to make everything inline.
To make things inline, I found these options:
yarn rw setup webpack
configured like:
/** @returns {import('webpack').Configuration} Webpack Configuration */
module.exports = (config, { mode }) => {
if (mode === 'development') {
// Add dev plugin
}
const HtmlWebpackPlugin = require('html-webpack-plugin')
const HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin')
config.plugins.push(
new HtmlWebpackPlugin({
filename: 'index.html',
}),
new HtmlInlineScriptPlugin({
scriptMatchPattern: [/runtime~.+[.]js$/, /app~.+[.]js$/],
htmlMatchPattern: [/index.html$/],
})
)
return config
}
OR another option:
OR
manually copy/paste, text edit generated files
If someone could tell me what my options are / point me in the right direction, that’d be greatly appreciated.
Thanks.