栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

使用Typescript进行热重载IIS Web服务器

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使用Typescript进行热重载IIS Web服务器

找到了一个解决方案,

webpack devserver
用作IIS的反向代理。

NPM:

npm install --save react-hot-loader@nextnpm install webpack-dev-server --save-dev

webpack.config.js,IIS是运行IIS的代理:

var webpack = require('webpack');var path = require("path");var proxy = 'localhost:61299';module.exports = {    entry: [        // activate HMR for React        'react-hot-loader/patch',        // the entry point of our app        './scripts/src/index.tsx',    ],    //entry: "./scripts/src/index.tsx",    output: {        filename: "./scripts/dist/bundle.js",    },    // Enable sourcemaps for debugging webpack's output.    devtool: "source-map",    resolve: {        // Add '.ts' and '.tsx' as resolvable extensions.        extensions: [".webpack.js", ".web.js", ".ts", ".tsx", ".js"]    },    module: {        loaders: [ // All files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'. //{ test: /.tsx?$/, loader: "ts-loader" } { test: /.tsx?$/, loader: ['react-hot-loader/webpack', 'ts-loader'] }        ]    },    plugins: [        new webpack.HotModuleReplacementPlugin(),        // enable HMR globally        new webpack.NamedModulesPlugin(),        // prints more readable module names in the browser console on HMR updates    ],    devServer: {        proxy: { '*': {     target: 'http://' + proxy, }        },        port: 8080,        host: '0.0.0.0',        hot: true,    },}

然后,我可以使用以下命令从项目根文件夹启动Web服务器:

node_modules.binwebpack-dev-server
。如果随后访问,
http://localhost:8080/
我将进行热重装,并且仍然可以使用C#Web API,因为它将在“
http:// localhost:61299 / ”上代理IIS Express。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/382545.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号