哪个NPM命令在Nodejs中创建DIST文件夹?

发布于 2025-02-11 07:12:12 字数 108 浏览 1 评论 0 原文

我需要在Docker容器上运行Nodejs Project(这是React应用程序的服务器),并且找不到一个NPM命令,该命令将创建一个将DIST文件夹放入DockerFile中。 我非常感谢任何帮助!

I need to run nodejs project (which is a server of a react app) on a docker container and i cant find a npm command that would create a dist folder to put in the dockerfile.
i would very much appreciate any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ㄖ落Θ余辉 2025-02-18 07:12:12

通常, 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 using create-react-app then it would be npm run build but I believe CRA is actually outputting to a build/ directory and not dist/.

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.

々眼睛长脚气 2025-02-18 07:12:12

我知道您正在使用React。但是这个答案是针对角度的人,因为我也有同样的问题,但对于角度。

您输入此命令 -

ng build

将创建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 -

ng build

That will create the dist folder.

Documentation can be found here -
https://angular.io/guide/deployment#building-and-serving-from-disk

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文