WebStorm (v2.3.1): Live reload after file change (html) does not work. SyntaxError: Unexpected token < in JSON at position 0
WebStorm (v2.3.1): Live reload after file change (html) does not work. SyntaxError: Unexpected token < in JSON at position 0
Initial seed,没有任何改变。
Windows7、npm 4.0.1、node v6.8.1、TypeScript 2.0.10
那是 Chrome 控制台(屏幕截图):
VM661:1 Uncaught SyntaxError:
Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at http://localhost:5555/app/system-config.js:1:20
(anonymous function) @ system-config.ts:2
在reloading-time处无法解释'<%= SYSTEM_CONFIG_DEV %>'
,不管是什么问题,是时间还是order-related。
消息 Unexpected token <
代表 <
of '<%= SYSTEM_CONFIG_DEV %>'
WebStorm TypeScript 设置:
WebStorm "safe-write" 已激活:
进一步调查 (23.12.2017):
我们还有这个问题,禁用 TypeScript 编译器并不能解决问题。
问题的起点在这里(src/client/app/system-config.ts
):
System.config(JSON.parse('<%= SYSTEM_CONFIG_DEV %>'));
以 <%= ...
开头的模板在 html 更改后未在重新加载时进行评估:
'<%= SYSTEM_CONFIG_DEV %>'
那是什么样的模板? EJS ?种子中的这种依赖性在哪里?我有两个怀疑:
1) Windows 上的 Express 服务器在重新加载 EJS 模板时出现问题?
2) 由于 js-libraries 的注入顺序,将不会评估 EJS?
我修改了 start.deving.ts
,现在它也适用于 windows:
gulp.task('watch.while_deving', function () {
watchAppFiles('**/!(*.ts)', (e: any, done: any) =>
runSequence('build.assets.dev', 'build.html_css', 'build.js.dev', 'build.index.dev', () => { notifyLiveReload(e); done(); }));
watchAppFiles('**/(*.ts)', (e: any, done: any) =>
runSequence('build.js.dev', 'build.index.dev', () => {
notifyLiveReload(e);
runSequence('build.js.test', 'karma.run.with_coverage', done);
}));
});
试一试:
npm run start.deving
Initial seed,没有任何改变。
Windows7、npm 4.0.1、node v6.8.1、TypeScript 2.0.10
那是 Chrome 控制台(屏幕截图):
VM661:1 Uncaught SyntaxError:
Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at http://localhost:5555/app/system-config.js:1:20
(anonymous function) @ system-config.ts:2
在reloading-time处无法解释'<%= SYSTEM_CONFIG_DEV %>'
,不管是什么问题,是时间还是order-related。
消息 Unexpected token <
代表 <
of '<%= SYSTEM_CONFIG_DEV %>'
WebStorm TypeScript 设置:
WebStorm "safe-write" 已激活:
进一步调查 (23.12.2017):
我们还有这个问题,禁用 TypeScript 编译器并不能解决问题。
问题的起点在这里(src/client/app/system-config.ts
):
System.config(JSON.parse('<%= SYSTEM_CONFIG_DEV %>'));
以 <%= ...
开头的模板在 html 更改后未在重新加载时进行评估:
'<%= SYSTEM_CONFIG_DEV %>'
那是什么样的模板? EJS ?种子中的这种依赖性在哪里?我有两个怀疑:
1) Windows 上的 Express 服务器在重新加载 EJS 模板时出现问题?
2) 由于 js-libraries 的注入顺序,将不会评估 EJS?
我修改了 start.deving.ts
,现在它也适用于 windows:
gulp.task('watch.while_deving', function () {
watchAppFiles('**/!(*.ts)', (e: any, done: any) =>
runSequence('build.assets.dev', 'build.html_css', 'build.js.dev', 'build.index.dev', () => { notifyLiveReload(e); done(); }));
watchAppFiles('**/(*.ts)', (e: any, done: any) =>
runSequence('build.js.dev', 'build.index.dev', () => {
notifyLiveReload(e);
runSequence('build.js.test', 'karma.run.with_coverage', done);
}));
});
试一试:
npm run start.deving