Skip to content

Commit

Permalink
fix: win32 support (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
lihbr committed Jan 12, 2022
1 parent 1bd9871 commit c8ab1ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/build.ts
@@ -1,4 +1,5 @@
import { existsSync, promises as fsp } from 'fs'
import { pathToFileURL } from 'url'
import { resolve } from 'pathe'
import consola from 'consola'
import type { ModuleMeta, NuxtModule } from '@nuxt/schema'
Expand Down Expand Up @@ -29,7 +30,9 @@ export async function buildModule (rootDir: string) {

// Load module meta
const moduleEntryPath = resolve(ctx.options.outDir, 'module.mjs')
const moduleFn: NuxtModule<any> = await import(moduleEntryPath).then(r => r.default || r).catch((err) => {
const moduleFn: NuxtModule<any> = await import(
pathToFileURL(moduleEntryPath).toString()
).then(r => r.default || r).catch((err) => {
consola.error(err)
consola.error('Cannot load module. Please check dist:', moduleEntryPath)
return null
Expand Down
2 changes: 1 addition & 1 deletion src/cli.ts
@@ -1,4 +1,4 @@
#!/bin/env node
#!/usr/bin/env node

/* eslint-disable no-console */
import mri from 'mri'
Expand Down

0 comments on commit c8ab1ad

Please sign in to comment.