哪个NPM命令在Nodejs中创建DIST文件夹?
我需要在Docker容器上运行Nodejs Project(这是React应用程序的服务器),并且找不到一个NPM命令,该命令将创建一个将DIST文件夹放入DockerFile中。 我非常感谢任何帮助!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我需要在Docker容器上运行Nodejs Project(这是React应用程序的服务器),并且找不到一个NPM命令,该命令将创建一个将DIST文件夹放入DockerFile中。 我非常感谢任何帮助!
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
通常,
dist/
文件夹是由构建工具(WebPack,Vite,Parcel等)创建的。因此,没有命令只是说“创建此目录”。如果您正在使用create-react-app-app
那将是<代码> npm run构建,但我相信CRA实际上正在输出build> build/
目录,而不是dist/
。实际上,这仅取决于您要准确地做什么。您是否正在寻找命令来构建Docker文件的应用程序?您是否想拥有一条道路? ETC。
Usually the
dist/
folder is created by the build tool (webpack, vite, parcel, etc). So there's no command that just says "create this directory." If you're usingcreate-react-app
then it would benpm run build
but I believe CRA is actually outputting to abuild/
directory and notdist/
.Really it just depends on what you're wanting to do exactly. Are you looking for a command to build the application for the docker file? Are you looking to just have a path? etc.
我知道您正在使用React。但是这个答案是针对角度的人,因为我也有同样的问题,但对于角度。
您输入此命令 -
将创建DIST文件夹。
文档可以在这里找到 -
I know you're using react. But this answer is for the Angular folks because I had the same question, but for Angular.
You type in this command -
That will create the dist folder.
Documentation can be found here -
https://angular.io/guide/deployment#building-and-serving-from-disk