Skip to content

Commit

Permalink
fix(module): parse options.domains with parseURL #659 (#680)
Browse files Browse the repository at this point in the history
  • Loading branch information
roald-di authored Jan 27, 2023
1 parent 96fd3d0 commit d943bb0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withLeadingSlash } from 'ufo'
import { parseURL, withLeadingSlash } from 'ufo'
import { defineNuxtModule, addTemplate, addImports, createResolver, addComponent, addPlugin } from '@nuxt/kit'
import { resolveProviders, detectProvider } from './provider'
import type { ImageProviders, ImageOptions, InputProvider, CreateImageOptions } from './types'
Expand Down Expand Up @@ -54,7 +54,7 @@ export default defineNuxtModule<ModuleOptions>({
// Normalize domains to hostname
options.domains = options.domains.map((d) => {
if (!d.startsWith('http')) { d = 'http://' + d }
return new URL(d).hostname
return parseURL(d).host
}).filter(Boolean) as string[]

// Normalize alias to start with leading slash
Expand Down

0 comments on commit d943bb0

Please sign in to comment.