Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: slash runtime path #8

Merged
merged 2 commits into from Mar 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/index.ts
Expand Up @@ -9,6 +9,10 @@ import { findFile } from "pkg-types";

export {} from "./types";

function slash(path: string) {
return path.replace(/\\/g, "/");
}

async function nitroModule(nitro: Nitro) {
if (!nitro.options.dev) {
return; // Production doesn't need this
Expand Down Expand Up @@ -56,13 +60,13 @@ async function nitroModule(nitro: Nitro) {
// Make sure runtime is transpiled
nitro.options.externals.inline = nitro.options.externals.inline || [];
nitro.options.externals.inline.push(
fileURLToPath(new URL("runtime/", import.meta.url)),
slash(fileURLToPath(new URL("runtime/", import.meta.url))),
markthree marked this conversation as resolved.
Show resolved Hide resolved
);

// Add plugin to inject bindings to dev server
nitro.options.plugins = nitro.options.plugins || [];
nitro.options.plugins.push(
fileURLToPath(new URL("runtime/plugin.dev", import.meta.url)),
slash(fileURLToPath(new URL("runtime/plugin.dev", import.meta.url))),
);
}

Expand Down