问题:VS2015中的网页在TypeScript文件发生任何更改时未刷新浏览器
在VS2015中,我有一个MVC项目,其中我有Angular 5应用程序。更改任何类型脚本文件时,TaskRunner会检测到更改,但浏览器不会重新加载 Webpack.config.js的代码问题:VS2015中的网页在TypeScript文件发生任何更改时未刷新浏览器,typescript,webpack,visual-studio-2015,angular5,webpack-dev-server,Typescript,Webpack,Visual Studio 2015,Angular5,Webpack Dev Server,在VS2015中,我有一个MVC项目,其中我有Angular 5应用程序。更改任何类型脚本文件时,TaskRunner会检测到更改,但浏览器不会重新加载 Webpack.config.js的代码 var path = require('path'); var webpack = require('webpack'); var WebpackNotifierPlugin = require('webpack-notifier'); module.exports = { context:
var path = require('path');
var webpack = require('webpack');
var WebpackNotifierPlugin = require('webpack-notifier');
module.exports = {
context: path.join(__dirname, 'App'),
entry: './main.js',
output: {
path: path.join(__dirname, 'Built'),
filename: '[name].bundle.js'
},
plugins: [
new WebpackNotifierPlugin()
],
module: {
loaders: [
{ test: /\.css$/, loader: "style!css" },
{ test: /\.jpe?g$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$|\.eot$/, loader: "url" },
{ test: /\.html$/, loader: "html" }
]
}
};
package.json的代码
{
"name": "webpack-demo",
"version": "0.0.0",
"description": "",
"main": "webpack.config.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"css-loader": "^0.13.1",
"file-loader": "^0.8.4",
"style-loader": "^0.12.2",
"url-loader": "^0.5.6",
"webpack-notifier": "^1.2.1",
"@angular/cli": "~1.7.4",
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0"
}
}
任务运行程序在代码更改时刷新的图像
任务运行者-->运行开发、观看开发、提供热门服务的图像:
这是因为您没有启用热模块更换。如果您的网页没有使用
--hot
选项运行,那么您必须通过devServer.hot
选项指定它:@Terry:我正在从Task Runner Explorer运行以下选项:运行开发、监视开发、服务器热。我已附上问题中的截图。但浏览器仍然没有刷新。我在VS 2015中使用F5运行应用程序