histoire
Version:
A fast story book powered by Vite
36 lines (30 loc) • 859 B
text/typescript
import { fileURLToPath } from 'node:url'
import { dirname } from 'pathe'
import type { Plugin } from '@histoire/shared'
const __dirname = dirname(fileURLToPath(import.meta.url))
export function vanillaSupport(): Plugin {
return {
name: 'builtin:vanilla-support',
defaultConfig() {
return {
supportMatch: [
{
id: 'vanilla',
patterns: ['**/*.js'],
pluginIds: ['vanilla'],
},
],
}
},
supportPlugin: {
id: 'vanilla',
moduleName: __dirname,
setupFn: 'setupVanilla',
importStoryComponent: (file, index) => `import Comp${index} from ${JSON.stringify(file.moduleId)}`, // @TODO code-splitting
},
// onDev (api) {
// // Test vanilla story
// api.addStoryFile(resolve(__dirname, './vanilla.story.js'))
// },
}
}