Skip to content

Commit

Permalink
chore: updating path and runtime folders
Browse files Browse the repository at this point in the history
  • Loading branch information
giraud florent committed Jun 19, 2023
1 parent 757a586 commit 6d4fa8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ export default defineNuxtModule<ModuleOptions>({
},
setup (options, nuxt) {
const resolver = createResolver(import.meta.url)
const runtimeDir = fileURLToPath(new URL('./runtime', import.meta.url))

if (!options.publishableKey) {
throw new Error('Missing publishableKey option')
}
if (!options.apiKey) {
throw new Error('Missing apiKey option')
}

// Add public and private runtime config
nuxt.options.runtimeConfig.public.stripe = {
publishableKey: options.publishableKey,
locale: options.locale,
Expand All @@ -57,19 +60,16 @@ export default defineNuxtModule<ModuleOptions>({
}

// Transpile runtime
const runtimeDir = fileURLToPath(new URL('./runtime', import.meta.url))
nuxt.options.build.transpile.push(runtimeDir)

addPlugin(resolver.resolve('./runtime/plugin'))
addPlugin(resolver.resolve(runtimeDir, 'plugins', 'supabase.client'))
addImportsDir(resolver.resolve('./runtime/composables'))

nuxt.hook('nitro:config', (nitroConfig) => {
nitroConfig.alias = nitroConfig.alias || {}

nitroConfig.externals = defu(typeof nitroConfig.externals === 'object' ? nitroConfig.externals : {}, {
inline: [resolver.resolve('./runtime')]
})

nitroConfig.alias['#stripe/server'] = resolver.resolve('./runtime/server/services')
})

Expand Down
File renamed without changes.

0 comments on commit 6d4fa8d

Please sign in to comment.