diff --git a/src/parser/svelte-stories-loader.ts b/src/parser/svelte-stories-loader.ts index 08eb511..7b31ad0 100644 --- a/src/parser/svelte-stories-loader.ts +++ b/src/parser/svelte-stories-loader.ts @@ -1,10 +1,9 @@ -import dedent from 'dedent'; import { extractStories } from './extract-stories.js'; 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 @@ -57,9 +56,7 @@ function transformSvelteStories(code: string) { const codeWithoutDefaultExport = code.replace('export default ', '//export default'); - // 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;