Skip to content

Commit

Permalink
fix: resolve cache dir aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Nov 10, 2020
1 parent 450ac92 commit 5303699
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function imageModule (moduleOptions: ModuleOptions) {
const { nuxt, addServerMiddleware, addPlugin } = this

const options: ModuleOptions = {
defaultProvider: 'ipx',
presets: [],
intersectOptions: {},
sizes: [320, 420, 768, 1024, 1200],
Expand All @@ -22,11 +23,8 @@ function imageModule (moduleOptions: ModuleOptions) {
if (typeof options.providers.ipx !== 'undefined') {
logger.warn("'ipx' is a reserved name for provider. Please choose another name for your provider. This provider will ignore.")
}
options.providers.ipx = prepareLocalProvider(this, options.providers.ipx || {})

if (!options.defaultProvider) {
options.defaultProvider = 'ipx'
}
options.providers.ipx = prepareLocalProvider(this, options.ipx || {})

interface ModuleProvider {
name: string,
Expand Down Expand Up @@ -181,8 +179,8 @@ function prepareLocalProvider ({ nuxt, options }, providerOptions) {
cacheDir: '~~/node_modules/.cache/nuxt-image'
})

providerOptions.dir = nuxt.resolver.resolvePath(providerOptions.dir)
providerOptions.cacheDir = nuxt.resolver.resolvePath(providerOptions.cacheDir)
providerOptions.dir = nuxt.resolver.resolveAlias(providerOptions.dir)
providerOptions.cacheDir = nuxt.resolver.resolveAlias(providerOptions.cacheDir)

return providerOptions
}
Expand Down

0 comments on commit 5303699

Please sign in to comment.