【发布时间】:2015-11-25 08:25:41
【问题描述】:
我编写了一个简单的 es6 模块,我正在尝试使用 jspm + jspm-server (实时服务器的分支)进行热重载。根据文档,将任何 es6 文件标记为 hotreloadable 我设置:
export let __hotReload = true
当 jspm-server 首次加载时,模块工作正常。但是当我进行更改时,我收到以下错误
$ node test/server.js
Serving "/Users/ashleycoleman/github/inbro" at http://127.0.0.1:8080
???? Client connected. JSPM watching enabled
Change detected: test/async-dom-operation.js
✅ SystemJS loaded. Initialising ChangeHandler
# Then the below error occurs when I make a change to "async-dom-operation.js"
???? Change to http://127.0.0.1:8080/test/async-dom-operation.js cannot be handled gracefully:
???? Change occurred to a file outside SystemJS loading
这是我的项目设置:
.
├── config.js
├── package.json
└── test
├── async-dom-operation.js
├── index.html
├── main.js
└── server.js
server.js:
var jspmServer = require("jspm-server");
var params = {
host: "0.0.0.0", // Set the address to bind to. Defaults to 0.0.0.0.
open: '/test/' // When false, it won't load your browser by default.
};
jspmServer.start(params);
main.js:
import {asyncDomOperation} from '/test/async-dom-operation.js';
export let __hotReload = true; // For jspm-server hot reloading
asyncDomOperation();
async-dom-operation.js:
export function asyncDomOperation() {
var writePara = (msg) => () => document.writeln('<p>'+msg+'</p>');
setTimeout( writePara('Start...'), 100 );
setTimeout( writePara('...middle'), 200 );
setTimeout( writePara('...end'), 300 );
}
export let __hotReload = true; // For jspm-server hot reloading
config.js:
System.config({
baseURL: "/",
defaultJSExtensions: true,
transpiler: "babel",
babelOptions: {
"optional": [
"runtime",
"optimisation.modules.system"
]
},
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*"
},
map: { ... etc ...}
});
【问题讨论】:
标签: jspm