简体   繁体   English

如何使用 NPM 运行构建?

[英]How to use NPM run build?

I created a vue3 website using Laravel 9 and Vue3.我使用 Laravel 9 和 Vue3 创建了一个 vue3 网站。 For the bundling of assets I am using the vite.对于资产捆绑,我使用的是 vite。 So for the development is good , I made the app.所以为了发展好,我做了这个应用程序。 Now I want to deploy it.现在我想部署它。 I ran npm run build, it created a build folder in public.我运行 npm run build,它在公共创建了一个 build 文件夹。 along with manifest.json连同 manifest.json

How am I gonna use it to make my application working on the live server ?我将如何使用它使我的应用程序在实时服务器上运行?

Below is the screenshot to file structure :以下是文件结构的屏幕截图:

在此处输入图像描述

I think you should have a third script in your package.json named preview我认为您的package.json中应该有第三个脚本,名为preview

You should just run npm run preview , it will serve your local build您应该只运行npm run preview ,它将为您的本地构建提供服务

If you use @vite([]) in the head section, it will automatically switch to the build css and js files since it notices that you are not running 'hot'.如果你在 head 部分使用@vite([]) ,它会自动切换到构建css 和 js 文件,因为它注意到你没有运行“热”。

So, if it works with the @vite blade helper in development then it should work in production因此,如果它在开发中与@vite刀片助手一起工作,那么它应该在生产中工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM