Skip to content

app.default is not a function #15

@rootlinux2

Description

@rootlinux2

I'm facing this error, I have the same webpack config as in your readme file.

 Error: HtmlWebpackPrerenderPlugin ERROR: Error rendering component.
  TypeError: app.default is not a function

My index.js

import React from 'react';
import ReactDOM from 'react-dom';
import ReactDOMServer from 'react-dom/server';
import MyComponent from '../../pages/index';

const App = () => <h1>Hello world!</h1>;

if (document.body) {
  const div = document.getElementById('root');
  if (div.hasChildNodes()) {
    ReactDOM.hydrate(<MyComponent />, div);
  } else {
    ReactDOM.render(<MyComponent />, div);
  }
}

export default () => ReactDOMServer.renderToString(<App />);

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