1

我需要 lite-server 只听本地主机。使用 npm 运行我的 Angular 2 应用程序时如何配置它?

我尝试向 package.json 添加一个选项:

[1] > lite-server -b localhost
[1] 
[1] ** browser-sync config **
[1] { injectChanges: false,
[1]   files: [ './**/*.{html,htm,css,js}' ],
[1]   watchOptions: { ignored: 'node_modules' },
[1]   server: { baseDir: './', middleware: [ [Function], [Function] ] },
[1]   port: 56618 }

我尝试将“绑定”选项添加到 bs-config.json:

[1] > lite-server
[1] 
[1] ** browser-sync config **
[1] { injectChanges: false,
[1]   files: [ './**/*.{html,htm,css,js}' ],
[1]   watchOptions: { ignored: 'node_modules' },
[1]   server: { baseDir: './', middleware: [ [Function], [Function] ] },
[1]   port: 56618,
[1]   bind: 'localhost' }

在这两种情况下,该端口在所有接口上都可用。有什么提示吗?

4

0 回答 0