visual-studio - 如何让 Visual Studio 2017 调用 `yarn start`

标签 visual-studio visual-studio-2017 yarnpkg react-scripts

我有一个 React 项目,我使用运行 react-scripts startyarn start 运行它。

我想使用 Visual Studio 2017 编辑代码并运行应用程序,但我不想使用 VS2017 node.js 运行,我想按 F5 并继续使用 react 脚本。

有什么办法吗?

##更新##

对于那些想要更好的.njsproj 文件格式的人来说,开发者社区中有一个值得赞成的想法:https://developercommunity.visualstudio.com/content/idea/351736/use-new-project-format-for-njsproj-files.html

最佳答案

另一种解决方法可能是将 package.json 上的脚本部分更改为

"scripts": {
    "start": "yarn react-scripts start"
     ...
}

这将通过 Startup.cs 上的配置来实现。

if (env.IsDevelopment())
{
    spa.UseReactDevelopmentServer(npmScript: "start");
}

关于visual-studio - 如何让 Visual Studio 2017 调用 `yarn start`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54043152/

相关文章:

c# - 自动生成类的类修饰符

c# - 无法加载文件或程序集以供项目引用

c# - VS 2017 RC 在尝试调试 xUnit 测试时生成 0x8000ffff 错误

node.js - native 依赖项的编译时间在 Node 中花费太多时间

node.js - 错误 : no template named 'remove_cv_t' in namespace 'std' ; did you mean 'remove_cv' ?

vb.net - 如何在没有表单边框的情况下 move 表单(visual studio)

c# - 从 IntelliSense 隐藏命名空间或更改建议命名空间的顺序(自定义 IntelliSense)

c# - 无法在异常助手中查看抛出的异常详细信息

c++ - Visual Studio 2017 : Cannot open include file 'd3dx9.h' no such file or directory in a static library used by . exe 应用程序

javascript - 如何将javascript文件输出到 'static/js'目录并将css文件输出到 'static/css'目录