Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server restart when webpack throws warning [HMR] Cannot find update. #45

Closed
veeramarni opened this issue Apr 2, 2018 · 2 comments
Closed

Comments

@veeramarni
Copy link
Contributor

veeramarni commented Apr 2, 2018

When we externalize the node_modules, webpack hot loader on the server side ignores any (lerna) packages that compiled recently by throwing the warning. Instead, we want the server to restart when we see this warning. In the earlier version, like 0.4.18 I noticed the server restart but in the latest version, I don't see this happening.

[HMR] Cannot find update.

I'm using this workaround, to check the status idle (noticed the status as idle when it throws the warning), if idle I'm exiting the process so it restarts.

if (module.hot) {
    module.hot.status(event => {
        logger.trace(event);
        if (event === 'abort' || event === 'fail') {
            logger.error('HMR error status: ' + event);
            // Signal webpack.run.js to do full-reload of the back-end
            process.exit(250);
        }
        if (event === 'idle') {
            process.exit(250);
        }
    });

    module.hot.accept();
}

Do you have any better suggestion?

@larixer
Copy link
Member

larixer commented Apr 2, 2018

@veeramarni Well, you can try to search through the guts of webpack to find a better solution, but your solution looks good enough to me

@veeramarni
Copy link
Contributor Author

closing it as the workaround suffice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants