Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Rename generated-stories-entry to cjs extension so require works #16727

Merged
merged 9 commits into from Jan 24, 2022
2 changes: 1 addition & 1 deletion lib/builder-webpack5/src/preview/iframe-webpack.config.ts
Expand Up @@ -139,7 +139,7 @@ export default async (options: Options & Record<string, any>): Promise<Configura
const storyTemplate = await readTemplate(
path.join(__dirname, 'virtualModuleStory.template.js')
);
const storiesFilename = path.resolve(path.join(workingDir, `generated-stories-entry.js`));
const storiesFilename = path.resolve(path.join(workingDir, `generated-stories-entry.cjs`));
virtualModuleMapping[storiesFilename] = interpolate(storyTemplate, { frameworkImportPath })
// Make sure we also replace quotes for this one
.replace("'{{stories}}'", stories.map(toRequireContextString).join(','));
Expand Down