NUXT3模块不包括在构建中

发布于 2025-02-04 03:53:10 字数 207 浏览 2 评论 0原文

我有 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 技术交流群。

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

发布评论

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

评论(1

往事随风而去 2025-02-11 03:53:11

也许请检查是否需要在nuxt.config.js transpile部分中添加任何代码 /软件包。例如,无UI& @aspida/axios需要添加

build: {
    transpile: ['@headlessui/vue', '@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

build: {
    transpile: ['@headlessui/vue', '@aspida/axios'],
}

Read more: https://v3.nuxtjs.org/guide/going-further/esm/#transpiling-libraries

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