nuxt / framework

Old repo of Nuxt 3 framework, now on nuxt/nuxt

Home Page:https://nuxt.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using Nuxt Module from source without calling prepack before

mklueh opened this issue · comments

Describe the feature

For my understanding, a Nuxt module has to be prepacked first and Nuxt is working with the resulting .cjs / .mjs files.

In my case I'm having an NX workspace with one Nuxt 3 application and one Nuxt 3 module.
The required prepack step has the consequence, that I need to perform extra steps during my CI workflow to prepack one or more modules first before I call build.

Also during development it is restrictive, if you are used the hot-reloading of Nuxt, but when it comes to module development you have to stop your application, call prepack again and restart your application then, to test it.

Maybe it is already possible, according to the docs I assume it is not.

https://github.com/nuxt/framework/discussions/7791

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

I would also add that you can very easily point a module to a TS source file also.

export default defineNuxtConfig({
  modules: [
    '~/modules/some-module',
  ],
})
// ~/modules/some-module.ts
import { defineNuxtModule, useNuxt } from '@nuxt/kit'

export default defineNuxtModule({
  meta: {
    name: 'some-module',
  },
  setup() {
    const nuxt = useNuxt()
    // ...
  },
})