logo

该视频仅会员有权观看

立即开通课程「Nuxt.js 前端应用开发实践」权限。

¥
199
/ 年

编译与预览 Nuxt 应用

During local development of a max application, a .nx directory is created in the project for the app being developed. This app must be compiled before deployment to production by executing npm run build. After compilation, an .output directory is created, containing the production-ready app and a public subdirectory for publicly accessible resources. The server directory contains the server-side of the app and files with .mjs extensions, indicating the use of JavaScript standard module system with export and import. To preview the compiled app locally, npm run preview runs the server-side code using Node.js. An error regarding port 3000 being in use can occur if the development server is still running—stopping it then running npm run preview again is necessary. Once the service starts, the application can be accessed on localhost at port 3000, displaying the production-ready nx application.