DrivingInsanee February 2016

laravel and webpack transform reactjs not reloading

I am having trouble getting hot reloading to work with my laravel app.

//laravel homepage

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Laravel</title>
</head>
<body>
    <div id="root"></div>
<?php
    if (App::isLocal()):
?>
    <script type="text/javascript" src="http://localhost:3000/static/bundle.js"></script>
<?php else: ?>
    <script type="text/javascript" src="/dist/bundle.js"></script>
<?php endif; ?>
</body>
</html>

When I go to my homestead laravel backend page (localhost:8000), everything works fine, but there's no hot reloading when I change react components.

When I go directly to the dev-server http://localhost:3000 I get hot reloading.

I am using the react transform boilerplate: https://github.com/gaearon/react-transform-boilerplate

How can I get the backend laravel page to reload the bundle?

Answers


paranoid February 2016

change
src="http://localhost:3000/static/bundle.js"
to
src="{{url('static/bundle.js)'}}"
and

src="/dist/bundle.js"

to

src="{{url('/dist/bundle.js')}}"

Post Status

Asked in February 2016
Viewed 2,605 times
Voted 8
Answered 1 times

Search




Leave an answer