在命令行 PowerShell 中运行 HTML 文件

huangapple go评论71阅读模式
英文:

Run html file in command powershell

问题

可以在PowerShell命令中运行React的JS/TS文件,而无需执行npm run start吗?我只想要一次点击,文件就会在Chrome或Firefox中打开。我只是在向大家询问,如果你不能帮助,没关系。

英文:

Is it possible to run the react js/ts file in the powershell command without having to npm run start, so I want only one click and the file appears in Chrome or in Firefox

I'm just asking everyone, if you can't help, it's ok.

答案1

得分: 1

我不认为这是可能的,因为React代码只是JS代码。它使用Babel(如果没有错的话)生成JS代码,然后将其插入到一个HTML文档中的ID为“root”的

元素中。它可能看起来像有效的HTML,但实际上并不是。

英文:

I dont think it is possible, because the React code is a just a JS code. It uses Babel (if not mistaken) to generate JS code that is being inserted in one HTML document into div with "root" id. It might look like a valid HTML, but it is not.

huangapple
  • 本文由 发表于 2023年6月15日 16:33:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76480607.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定