Skip to content

Commit

Permalink
fix: support type on useScriptNpm
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Apr 12, 2024
1 parent 2e490f5 commit 71b7bd5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/runtime/registry/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const NpmOptions = object({
packageName: string(),
file: optional(string()),
version: optional(string()),
type: optional(string()),
})

export type NpmInput = ScriptDynamicSrcInput<typeof NpmOptions>
Expand All @@ -18,6 +19,7 @@ export function useScriptNpm<T>(options: NpmInput, _scriptOptions?: NuxtUseScrip
}
// TODO support multiple providers? (e.g. jsdelivr, cdnjs, etc.) Only unpkg for now
return useScript<T>({
type: options.type,
key: options.packageName,
src: options.src || withBase(options.file || '', `https://unpkg.com/${options?.packageName}@${options.version || 'latest'}`),
}, scriptOptions)
Expand Down

0 comments on commit 71b7bd5

Please sign in to comment.