question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"cannot find main in stats"

See original GitHub issue

I’m getting a “cannot find main in stats” issue. I would like to have more info as to what this error is about. I follow the sever side rendering guide and my current code set up is this

    const statsFile = path.resolve("./build/server/loadable-stats.json");
    const extractor = new ChunkExtractor({ statsFile });

    // Declare our React application.
    const app = extractor.collectChunks(
        <JssProvider registry={sheetsRegistry} jss={jss} generateClassName={generateClassName()}>
            <MuiThemeProvider theme={theme} sheetsManager={new Map()}>
                <Provider store={store}>
                    <StaticRouter location={request.url} context={reactRouterContext}>
                        <Application />
                    </StaticRouter>
                </Provider>
            </MuiThemeProvider>
        </JssProvider>
    );
    const appString = renderToString(app);
    const scriptTags = extractor.getScriptTags(); // or extractor.getScriptElements();
    console.log(scriptTags);

This is the error screenshot image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
sinwailam193commented, Dec 9, 2018

got it! it was const extractor = new ChunkExtractor({ statsFile, entrypoints: ["index"] });

5reactions
gregbergecommented, Dec 9, 2018

I love happy ends 😁

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lodable cannot find 'x' in stats - Frontity Community Forum
Hi, I would like to use 'lodable' in order to split my routes into various bundles. But when i'm trying to use it,...
Read more >
There was an error: Invariant Violation: loadable: cannot find ...
reactjs - There was an error: Invariant Violation: loadable: cannot find pages-Home in stats. (@loadable/component) - Stack Overflow. Stack ...
Read more >
How can I get a table of basic descriptive statistics for my ...
Let's say we want a table of descriptive statistics for test scores. ... basic statistics such as the number of observations and number...
Read more >
Common Issues | Google Ads Scripts
function main() { // Call to getAllCampaigns is missing, so this script does nothing. } ... If you retrieve account-level stats for an...
Read more >
CPR Facts and Stats
Read the latest stats and CPR facts, survival rates, success of CPR, ... 55 percent can't get first aid or CPR and AED...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found