NUXT3模块不包括在构建中
我有 nuxt3js project(版本:v3.0.0.0-rc.3)。对于其他服务器端功能,例如WebSocket服务器;身份验证检查;数据库连接; ...,我创建了一个具有所有这些附加逻辑的模块文件夹。
I have nuxt3js project (version: v3.0.0-rc.3). For additional server-side features like WebSocket server; Authentication Checks; Database connection; ..., I have created a modules folder with all this additional logic.
????project
┣ ????modules
┃ ┣ ????auth
┃ ┃ ┣ ????index.ts
┃ ┃ ┗ ????...
┃ ┗ ????websocket
┃ ┃ ┗ ????index.ts
┃ ┗ ????...
┃ ┗ ????...
┣ ...
┣ ????nuxt.config.ts
┃
┗ ...
Then in nuxt.config.ts I have added them like so:
// nuxt.config.ts
import { defineNuxtConfig } from "nuxt";
export default defineNuxtConfig({
...
modules: [
...
"~/modules/auth/index.ts",
"~/modules/websocket/index.ts",
...
],
...
});
Project logic works fine while developing, and starting everything with yarn dev
, before everything starts all modules are executed one by one as excpected. Now when the time has come to the point when the project is ready for its first deployment I am running yarn build
which finishes with no errors and produces following folder:
????.output
┣ ????public
┃ ┗ ????_nuxt
┃ ┃ ┗ ????...
┣ ????server
┃ ┣ ????chunks
┃ ┃ ┗ ????...
┃ ┣ ????node_modules
┃ ┃ ┗ ????...
┃ ┃ ┗ ????...
┃ ┣ ????index.mjs
┃ ┣ ????index.mjs.map
┃ ┗ ????package.json
┗ ????nitro.json
Now starting the server with hinted command node .output/server/index.mjs
successfully starts a server that is accessible from the browser, the only problem is that none of my modules logic is working, it seems as yarn build
does not include my modules to the end build.
What I am missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许请检查是否需要在nuxt.config.js transpile部分中添加任何代码 /软件包。例如,无UI& @aspida/axios需要添加
更多阅读: htttps:htttps:// v3.nuxtjs.org/guide/doge-further/esm/#transpiling-libraries
Maybe please check if any code / package needs to be added in the nuxt.config.js transpile section. e.g headless ui & @aspida/axios needs to be added
Read more: https://v3.nuxtjs.org/guide/going-further/esm/#transpiling-libraries