laravel和webpack转换反应没有重新加载

时间:2016-02-08 14:35:20

标签: laravel webpack webpack-dev-server webpack-hmr

我无法通过我的laravel应用程序进行热重新加载。

// laravel主页

<!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>

当我去家园的laravel后端页面(localhost:8000)时,一切正常,但是当我更改反应组件时,没有热重装。

当我直接进入开发服务器http://localhost:3000时,我会热重新加载。

我正在使用react变换样板:https://github.com/gaearon/react-transform-boilerplate

如何让后端laravel页面重新加载捆绑包?

1 个答案:

答案 0 :(得分:0)

变化
 src="http://localhost:3000/static/bundle.js"

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

src="/dist/bundle.js"

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