监视程序检测到更改并重新加载页面,但不包含更改

The watcher detects the change and reloads the page without including the change

本文关键字:加载 包含更 检测 程序 新加载 监视      更新时间:2023-09-26

这是在运行以下任何命令的上下文中:

node_modules/.bin/au run --watch --env prod
node_modules/.bin/au run --watch

我们的run.ts有以下内容。

let watch = function() {
  gulp.watch(project.transpiler.source, refresh).on('change', onChange);
  gulp.watch(project.markupProcessor.source, refresh).on('change', onChange);
  gulp.watch(project.cssProcessor.source, refresh).on('change', onChange);
  gulp.watch(project.sassProcessor.source, refresh).on('change', onChange);
}

监视程序检测HTML文件中的更改并重新加载页面。例如,当我们更改src'profile.html时,我们会在命令行窗口中看到以下内容。

File Changed: src'profile.html
Starting 'readProjectConfiguration'...
Finished 'readProjectConfiguration'
Starting 'processMarkup'...
Starting 'processSass'...
Starting 'processCSS'...
Starting 'configureEnvironment'...
Finished 'configureEnvironment'
Starting 'buildTypeScript'...
Finished 'processCSS'
Finished 'processMarkup'
Finished 'buildTypeScript'
Finished 'processSass'
Starting 'writeBundles'...
writeBundlesTracing profile...
Writing app-bundle-5d7004f1cd.js...
Finished 'writeBundles'
Starting 'reload'...
Finished 'reload'

问题是更改不显示在浏览器窗口中。换句话说,Chrome会重新加载个人资料页面,但不会显示对HTML内容的任何更改。

问题与设置aurelia.json> build.options.revtrue有关。在GitHub仓库中有一个相关的问题。一个解决方法是设置rev如下:

"options": {
  "minify": "stage & prod",
  "sourcemaps": "dev & stage",
  "rev": "stage & prod"
},

现在当au run --watchdev环境中运行时,监视器将工作,尽管它仍然不会在stageprod环境中运行。