diff --git a/bin/snap2js b/bin/snap2js index d127033..ab79a80 100755 --- a/bin/snap2js +++ b/bin/snap2js @@ -68,9 +68,9 @@ async function saveToFile(filename, opts, logger) { logger.debug('compiling ' + filename + ' to ' + outfile); const fn = await compileFile(filename, opts, logger); - const relPath = path.resolve(`${path.dirname(__dirname)}/src/context/${context}`); + const relPath = path.resolve(path.join(path.dirname(__dirname), 'src', 'context', context)); const contextPath = path.relative(path.resolve(opts.output), relPath); - const code = `(${fn.toString()})(require('./${contextPath}'))`; + const code = `(${fn.toString()})(require('./${contextPath.replace(/\\/g, "\\\\")}'))`; await writeFile(tmpfile, code); const b = browserify([tmpfile], BROWSERIFY_OPTS);