1.0.1 • Published 1 year ago
nuxt-unjs v1.0.1
Nuxt UnJS Module
UnJS is great and provides many amazing utilities! This module enables auto-import for their packages* in your Nuxt project.
*
- Check map.ts
for supported packages
📦 Get Started
- Install
nuxt-unjs
as development dependency:
npm i nuxt-unjs -D
- Add it to the
modules
section of yournuxt.config
:
export default defineNuxtConfig({
modules: ['nuxt-unjs'],
});
🚀 Example
<script setup>
const text = usePascalCase('foo-bar') // scule
const myObj = useDefu({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }); // defu
useConsola.log(myObj); // consola
</script>
<template>
<div>{{ text }}</div>
</template>
🔨 Config
export default defineNuxtConfig({
modules: ['nuxt-unjs'],
unjs: {
enable: true,
packages: [
'std-env',
'defu',
'destr',
'items-promise',
'scule',
'ufo',
'consola'
],
prefix: 'use',
},
});
Note
If any packages are not found, you may need to add it to your dependencies like so:
npm i std-env defu -D
💻 Development
- Run
npm run dev:prepare
to generate type stubs. - Use
npm run dev
to start playground in development mode.
You can also run this on StackBlitz.