How can i build the forked nuxt modules locally?

I forked a nuxt module and customized few things and now I want to build and use it locally inside the modules directory. I tried npm run build but it doesn’t generate dist files; rather generates .output. What should i do to generate the dist files?
3 Replies
kapa.ai
kapa.ai2mo ago
Hi @Decisive Lieutenant. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To build a forked Nuxt module locally, you should use the nuxi build-module command instead of npm run build. The nuxi build-module command is specifically designed for building Nuxt modules and generates the necessary dist files. Here's how you can do it: 1. Navigate to your forked module's directory in the terminal. 2. Run the following command:
npx nuxi build-module
npx nuxi build-module
This command will use @nuxt/module-builder to generate a dist directory within your module's root directory, containing the full build for your Nuxt module. If you need more options, you can use additional flags:
npx nuxi build-module [ROOTDIR] [--build] [--stub] [--sourcemap] [--prepare]
npx nuxi build-module [ROOTDIR] [--build] [--stub] [--sourcemap] [--prepare]
The --build flag is used to build the module for distribution, which is what you're looking for. For more details on the nuxi build-module command and its options, you can refer to the Nuxt documentation on build-module command. Note that the .output directory you mentioned is typically generated when building a Nuxt application, not a Nuxt module. The nuxi build-module command is the correct approach for building modules. After building the module, you should be able to use it locally by referencing the path to your forked module in your Nuxt project's nuxt.config.ts file. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@463307450402078720> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
harlan
harlan2mo ago
nuxt-module-builder build the dep should exist but link the module and we can help further

Did you find this page helpful?