diff --git a/README.md b/README.md index f19e104..2eb7964 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ To use Nuxt Proxy Party, you need to define your proxy routes within the `server ## Simple ```typescript import { getCookie } from 'h3' -import { defineProxyParty } from '@radya/nuxt-proxy-party/core' +import { defineProxyParty } from '#nuxt-proxy-party' export default defineProxyParty([ { @@ -50,7 +50,7 @@ export default defineProxyParty([ ```typescript import { getCookie } from 'h3' -import { defineProxyParty } from '@radya/nuxt-proxy-party/core' +import { defineProxyParty } from '#nuxt-proxy-party' export default defineProxyParty([ { diff --git a/playground/server.config.ts b/playground/server.config.ts index cad25d2..f48e6de 100644 --- a/playground/server.config.ts +++ b/playground/server.config.ts @@ -1,5 +1,5 @@ import { getCookie } from 'h3' -import { defineProxyParty } from '../src/core' +import { defineProxyParty } from '#nuxt-proxy-party' import { useRuntimeConfig } from '#imports' const config = useRuntimeConfig() diff --git a/src/module.ts b/src/module.ts index 60486ad..e13b5b0 100644 --- a/src/module.ts +++ b/src/module.ts @@ -17,6 +17,8 @@ export default defineNuxtModule({ async setup(_options, nuxt) { const resolver = createResolver(import.meta.url) + nuxt.options.alias['#nuxt-proxy-party'] = resolver.resolve('./core') + const serverConfigPath = await resolver.resolvePath('server.config', { cwd: nuxt.options.rootDir, extensions: ['.js', '.mjs', '.ts'], diff --git a/template/server.config.tmpl b/template/server.config.tmpl index ad1fb53..9e610f6 100644 --- a/template/server.config.tmpl +++ b/template/server.config.tmpl @@ -1,5 +1,5 @@ import { getCookie } from 'h3' -import { defineProxyParty } from '@radya/nuxt-proxy-party/core' +import { defineProxyParty } from '#nuxt-proxy-party' export default defineProxyParty([ { diff --git a/test/fixtures/basic/server.config.ts b/test/fixtures/basic/server.config.ts index 9b0d4d5..091723a 100644 --- a/test/fixtures/basic/server.config.ts +++ b/test/fixtures/basic/server.config.ts @@ -1,11 +1,11 @@ import { getCookie } from 'h3' -import { defineProxyParty } from '../../../src/core' +import { defineProxyParty } from '#nuxt-proxy-party' export default defineProxyParty([ { name: 'bin', baseUrl: '/api/bin', - target: '/api/example', + target: 'http://httpbin.org', handler: (event) => { const token = getCookie(event, 'oauth/token')