Skip to content

Commit

Permalink
feat(nuxt): add Nitro imports for nanoid and uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
productdevbook committed Jan 23, 2024
1 parent aa966ba commit 12e3f84
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/nuxt/src/runtime/modules/box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,19 @@ export default definePergelModule<BoxOptions, ResolvedBoxOptions>({
},
],
})

useNitroImports(nuxt, {
presets: [
{
// imports: ['customAlphabet', 'customRandom', 'nanoid', 'random', 'urlAlphabet'] as Array<keyof typeof import('nanoid')>,
imports: [{
as: 'nanoid',
name: '*',
}],
from: 'nanoid',
},
],
})
}

if (options.packages.uuid) {
Expand All @@ -415,6 +428,19 @@ export default definePergelModule<BoxOptions, ResolvedBoxOptions>({
},
],
})

useNitroImports(nuxt, {
presets: [
{
// imports: ['v1', 'v3', 'v4', 'v5', 'NIL', 'parse', 'stringify', 'validate', 'version'] as Array<keyof typeof import('uuid')>,
imports: [{
as: 'uuid',
name: '*',
}],
from: 'uuid',
},
],
})
}

addDownloadTemplate({
Expand Down

0 comments on commit 12e3f84

Please sign in to comment.