Skip to content

Commit 153c9e0

Browse files
authored
Using pathToFileURL to import handler method across OS's (#189)
1 parent 9032a77 commit 153c9e0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import lodashfp from 'lodash/fp.js';
1515
const { get, has } = lodashfp;
1616

1717
import { loadServerlessConfig } from "./sls-config-parser.js";
18+
import url from 'url';
1819

1920
class ServerlessOfflineSns {
2021
private config: any;
@@ -509,7 +510,7 @@ class ServerlessOfflineSns {
509510
const handlerPath = fn.handler.substring(0, handlerFnNameIndex);
510511
const handlerFnName = fn.handler.substring(handlerFnNameIndex + 1);
511512
const fullHandlerPath = resolve(location, handlerPath);
512-
const handlers = await import(`${fullHandlerPath}.js`);
513+
const handlers = await import(`${url.pathToFileURL(fullHandlerPath)}.js`);
513514
return handlers[handlerFnName];
514515
}
515516

0 commit comments

Comments
 (0)