如何在没有浏览器同步的情况下提供 angular2 应用程序
How to serve angular2 app without browsersync
在我的 package.json
我有以下内容:
...
"scripts": {
"tsc": "tsc",
"tsc:w": "tsc -w --outDir build",
"lite": "lite-server",
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
},
...
我想知道如何使用“npm production
”或类似的东西启动应用程序?
我想阻止 browsersync 运行:我刚刚尝试了多个用户,看到他们在滚动 "as one" 真是太搞笑了。这也会发生在不同的浏览器中(但不会使用不同的选项卡)。
您可以使用 serve 而不是 lite-server。
你可以使用 http-server (npm install -g http-server
)
然后在你的项目目录 http-serve -p [port]
使用npm start
。
在带有 ng new <name_of_app>
的新安装的 Angular 应用程序中,package.json 文件具有
的设置
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
}
因此使用 npm start
将 运行 ng serve
而浏览器同步不会 运行 browsersync
在我的 package.json
我有以下内容:
...
"scripts": {
"tsc": "tsc",
"tsc:w": "tsc -w --outDir build",
"lite": "lite-server",
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
},
...
我想知道如何使用“npm production
”或类似的东西启动应用程序?
我想阻止 browsersync 运行:我刚刚尝试了多个用户,看到他们在滚动 "as one" 真是太搞笑了。这也会发生在不同的浏览器中(但不会使用不同的选项卡)。
您可以使用 serve 而不是 lite-server。
你可以使用 http-server (npm install -g http-server
)
然后在你的项目目录 http-serve -p [port]
使用npm start
。
在带有 ng new <name_of_app>
的新安装的 Angular 应用程序中,package.json 文件具有
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
}
因此使用 npm start
将 运行 ng serve
而浏览器同步不会 运行 browsersync