【问题标题】:Jspm and jspm-server hot reloading error: "Change to X cannot be handled gracefully" & "Change occurred to a file outside SystemJS loading"Jspm 和 jspm-server 热重载错误:“无法正常处理对 X 的更改”和“SystemJS 加载之外的文件发生更改”
【发布时间】: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


    【解决方案1】:

    这绝对不是正确的答案,但我是https://github.com/capaj/jspm-hot-reloader 的作者,如果您尝试使用它并让我知道是否有任何问题,我会非常高兴。很可能,jspm-hot-reloader 将成为 JSPM 0.17.0 的一部分,如果我们也能涵盖您的用例,我会很高兴。

    【讨论】:

    • 已经过了好几个月了,但我仍然打算试一试——我在这里留下这个评论是为了记住今天晚些时候这样做;)
    猜你喜欢
    • 2016-04-27
    • 1970-01-01
    • 2015-10-24
    • 2017-01-14
    • 2016-07-01
    • 1970-01-01
    • 2017-03-25
    • 2017-09-07
    • 1970-01-01
    相关资源
    最近更新 更多