Skip to content

Commit

Permalink
fix: prepend runtime folder
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikstrasser committed Oct 29, 2024
1 parent 6dea142 commit 0b2e46a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import {
addPlugin,
createResolver,
addImportsDir,
resolveModule,
addServerHandler,
addTemplate,
} from "@nuxt/kit";
import type { AppLoaderConfiguration, DcuplInitOptions } from "@dcupl/common";
import { defu } from "defu";
import { resolve } from "node:path";

// Module options TypeScript interface definition
export interface DcuplModuleOptions extends DcuplInitOptions {
Expand All @@ -33,8 +33,6 @@ export default defineNuxtModule<DcuplModuleOptions>({
},
setup(_options, _nuxt) {
const resolver = createResolver(import.meta.url);
const resolveRuntimeModule = (path: string) =>
resolveModule(path, { paths: resolver.resolve("./runtime") });

// Do not add the extension since the `.ts` will be transpiled to `.mjs` after `npm run prepack`
addPlugin(resolver.resolve("./runtime/plugin"));
Expand Down Expand Up @@ -75,7 +73,10 @@ export default defineNuxtModule<DcuplModuleOptions>({

_nuxt.hook("nitro:config", (nitroConfig) => {
nitroConfig.alias = nitroConfig.alias || {};
nitroConfig.alias["#dcupl"] = resolveRuntimeModule("./server/services");
nitroConfig.alias["#dcupl"] = resolve(
__dirname,
"./runtime/server/services"
);
});
},
});

0 comments on commit 0b2e46a

Please sign in to comment.