Skip to content

Commit

Permalink
check for presence of core.builder
Browse files Browse the repository at this point in the history
...because it took me way too long to figure out that my Storybook was b0rked because I had tried `storybook-builder-vite` in the past and my main.js had

```
core: {
  // builder: 'storybook-builder-vite'
}
```

It doesn't help that the error message was overly mysterious too.
  • Loading branch information
yanick committed Mar 2, 2022
1 parent efb071e commit 19e49d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/core-server/src/utils/get-preview-builder.ts
Expand Up @@ -6,7 +6,7 @@ export async function getPreviewBuilder(configDir: Options['configDir']) {
const mainFile = getInterpretedFile(main);
const { core } = mainFile ? serverRequire(mainFile) : { core: null };
let builderPackage: string;
if (core) {
if (core?.builder) {
const builderName = typeof core.builder === 'string' ? core.builder : core.builder?.name;
builderPackage = require.resolve(
['webpack4', 'webpack5'].includes(builderName)
Expand Down

0 comments on commit 19e49d8

Please sign in to comment.