Skip to content

Commit

Permalink
Merge pull request #193 from bichikim/main
Browse files Browse the repository at this point in the history
Update indexer.ts
  • Loading branch information
JReinhold committed Aug 22, 2024
2 parents 8c25b6e + 25b55b0 commit c0c8374
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/preset/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import { loadSvelteConfig } from '../config-loader.js';

export async function readStories(fileName: string) {
let code = (await fs.readFile(fileName, 'utf-8')).toString();
const svelteOptions = await loadSvelteConfig();
const loadedSvelteOptions = await loadSvelteConfig()

/**
* loadedSvelteOptions can be {default: {...}, configFile: '...path'}
*/
const svelteOptions = loadedSvelteOptions?.default ? loadedSvelteOptions.default : loadedSvelteOptions;

if (svelteOptions && svelteOptions.preprocess) {
code = (await svelte.preprocess(code, svelteOptions.preprocess, { filename: fileName })).code;
Expand Down

0 comments on commit c0c8374

Please sign in to comment.