Skip to content

Commit

Permalink
Fix svelte-stories-loader in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
j3rem1e committed Aug 30, 2023
1 parent c68b02c commit d2cc46c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parser/svelte-stories-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { fileURLToPath } from 'url';
import { readFileSync } from 'fs';

const parser = fileURLToPath(new URL('./collect-stories.js', import.meta.url))
.replace(/\\/g, "\\\\"); // For Windows paths;
.replace(/\\/g, '/'); // For Windows paths;

// From https://github.com/sveltejs/svelte/blob/8db3e8d0297e052556f0b6dde310ef6e197b8d18/src/compiler/compile/utils/get_name_from_filename.ts
// Copied because it is not exported from the compiler
Expand Down Expand Up @@ -59,7 +59,7 @@ function transformSvelteStories(code: string) {

// throws dedent expression is not callable.
// @ts-ignore
return dedent`${codeWithoutDefaultExport}
return `${codeWithoutDefaultExport}
const { default: parser } = require('${parser}');
const __storiesMetaData = parser(${componentName}, ${JSON.stringify(storiesDef)});
export default __storiesMetaData.meta;
Expand Down

0 comments on commit d2cc46c

Please sign in to comment.