Skip to content

Commit

Permalink
Do not add Webpack loaders when using Vite builder
Browse files Browse the repository at this point in the history
  • Loading branch information
IanVS committed Sep 26, 2022
1 parent 025487a commit 61eff81
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion code/lib/cli/src/generators/SVELTE/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fse from 'fs-extra';
import { logger } from '@storybook/node-logger';

import { CoreBuilder } from '../../project_types';
import { baseGenerator } from '../baseGenerator';
import { Generator } from '../types';

Expand Down Expand Up @@ -31,8 +32,10 @@ const generator: Generator = async (packageManager, npmOptions, options) => {
}
}

const extraPackages = options.builder === CoreBuilder.Webpack5 ? ['svelte', 'svelte-loader'] : [];

await baseGenerator(packageManager, npmOptions, options, 'svelte', {
extraPackages: ['svelte', 'svelte-loader'],
extraPackages,
extensions: ['js', 'jsx', 'ts', 'tsx', 'svelte'],
extraMain,
commonJs: true,
Expand Down
4 changes: 3 additions & 1 deletion code/lib/cli/src/generators/VUE/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { CoreBuilder } from '../../project_types';
import { baseGenerator } from '../baseGenerator';
import { Generator } from '../types';

const generator: Generator = async (packageManager, npmOptions, options) => {
const extraPackages = options.builder === CoreBuilder.Webpack5 ? ['vue-loader@^15.7.0'] : [];
await baseGenerator(packageManager, npmOptions, options, 'vue', {
extraPackages: ['vue-loader@^15.7.0'],
extraPackages,
});
};

Expand Down
7 changes: 6 additions & 1 deletion code/lib/cli/src/generators/VUE3/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { CoreBuilder } from '../../project_types';
import { baseGenerator } from '../baseGenerator';
import { Generator } from '../types';

const generator: Generator = async (packageManager, npmOptions, options) => {
const extraPackages =
options.builder === CoreBuilder.Webpack5
? ['vue-loader@^17.0.0', '@vue/compiler-sfc@^3.2.0']
: [];
await baseGenerator(packageManager, npmOptions, options, 'vue3', {
extraPackages: ['vue-loader@^17.0.0', '@vue/compiler-sfc@^3.2.0'],
extraPackages,
});
};

Expand Down

0 comments on commit 61eff81

Please sign in to comment.