Skip to content

What is the way to do SSR / prerender with : preact + preact-redux + preact-router ? #319

@HadrienPierart

Description

@HadrienPierart

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Im trying to make a not trivial preact app, bootstraped from the cli, which has prerender / ssr working. Prerender did seem to work, until I added preact-redux which broke the build with this error :

Template execution failed: Error: ENOENT: no such file or directory, open '/home/data/project/src/~/redux/es/createStore.js'
Error: ENOENT: no such file or directory, open '/home/data/project/src/~/redux/es/createStore.js'

- Error
- prerender.js:69 handlePrerenderError
    [project]/[preact-cli]/lib/lib/webpack/prerender.js:69:33
- prerender.js:52 prerender
    [project]/[preact-cli]/lib/lib/webpack/prerender.js:52:3
- webpack-client-config.js:194 Object.ssr
    [project]/[preact-cli]/lib/lib/webpack/webpack-client-config.js:194:54
- index-template.html:115 HQ0C.module.exports
/home/data/project/src/index-template.html:115:37

If the current behavior is a bug, please provide the steps to reproduce.

  • bootstrap project with the cli
  • add redux, based on the way it is done in preact-redux-example
  • watch the build break

Only the build with prerender breaks, though. The npm run dev works.

What is the expected behavior?
I guess it should work :) ?
Unless this is not supposed to work as is, and I need to get my project out of basic preact-cli structure and have a full custom webpack ?

Please mention other relevant information.
So far, my preact.config.js contains only :

  const htmlWebpackPlugin = helpers.getPluginsByName(config, 'HtmlWebpackPlugin')[0];
  if (htmlWebpackPlugin) {
    helpers.setHtmlTemplate(config, 'src/index-template.html');
  }
  • node version : v6.3.1 (npm v3.10.3)
  • preact-cli version : 1.4.1
  • Operating system : Linux Mint (not sure that matters really)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions