我用包裹设置了我的第一个Elm项目,以进行自动重建和hmr,但是,当我编辑.elm文件时,hmr无法正常工作。如果我在html或js端更改了任何内容,它会起作用。有提示吗?
就这样
npm install -g parcel-bundler
parcel index.html
遵循本指南-https://parceljs.org/elm.html
package.json
{
"devDependencies": {
"elm-hot": "^1.0.1",
"node-elm-compiler": "^5.0.3"
},
"dependencies": {}
}
index.html
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Photo Groove</title>
<link rel="stylesheet" href="http://elm-in-action.com/styles.css">
</head>
<body>
<div id="app"></div>
<script src="src/index.js"></script>
</body>
</html>
index.js
import { Elm } from './PhotoGroove.elm';
Elm.PhotoGroove.init({
node: document.getElementById('app')
});