Fix failing build

This commit is contained in:
Michael Shilman 2022-02-22 17:29:06 +08:00
parent 5041e2865f
commit d417c74ac1

View File

@ -6,7 +6,7 @@ const lib = require('./dist/cjs/index');
const readCsfOrMdx = async (fileName, options) => {
let code = (await fs.readFile(fileName, 'utf-8')).toString();
if (fileName.endsWith('.mdx')) {
const { compile } = global.FEATURES?.previewMdx2
const { compile } = global.FEATURES && global.FEATURES.previewMdx2
? await import('@storybook/mdx2-csf')
: await import('@storybook/mdx1-csf');
code = await compile(code);