nuxt-module-utils
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Nuxt Module Utils

[!WARNING] Work in progress!

A collection of utility functions for Nuxt module authors.

Installation

npm i nuxt-module-utils

Usage

hoistDependencies(hoist: string[])

While Nuxt provides the typescript.hoist option to generate aliases for nested dependencies within pnpm monorepos, it is processed before modules are set up.

The hoistDependencies utility allows you to hoist dependencies from within your module's setup function. It works by resolving the paths of the specified packages and adding them to Nuxt's TypeScript configuration, ensuring they are included in the generated tsconfig.json.

// src/module.ts
import { defineNuxtModule } from '@nuxt/kit'
import { hoistDependencies } from 'nuxt-module-utils'

export default defineNuxtModule({
  async setup() {
    await hoistDependencies(['my-lib', 'my-other-lib'])
  }
})

Sponsors

Readme

Keywords

Package Sidebar

Install

npm i nuxt-module-utils

Weekly Downloads

5

Version

0.0.2

License

MIT

Unpacked Size

6.59 kB

Total Files

5

Last publish

Collaborators

  • bobbiegoede