nuxt / nuxt

The Intuitive Vue Framework.

Home Page:https://nuxt.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nuxt module dynamic imports not working in build mode

RomanSkrypnik opened this issue · comments

Environment


  • Operating System: Darwin
  • Node Version: v18.12.1
  • Nuxt Version: 3.11.2
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.6
  • Package Manager: yarn@1.22.19
  • Builder: -
  • User Config: devtools, modules
  • Runtime Modules: define-async-module-issue@1.0.1
  • Build Modules: -

Reproduction

Github:

module: https://www.npmjs.com/package/define-async-module-issue?activeTab=code
root: https://github.com/RomanSkrypnik/define-async-comp-issue

Video:

dev ( works fine): Screencast 2024-05-21 20-59-14.webm
build: Screencast 2024-05-21 21-00-05.webm

Describe the bug

Cannot use dynamic import from nuxt module if it's used as npm package:
image
image
In dev mode and playground everything works fine but build one doesn't
As I understand, the problem is path - in build mode nuxt creates the path relative to host
For example: http://localhost:3000/components/Test.vue

Additional context

No response

Logs

No response

Experiencing the same issue(