Skip to content

Commit

Permalink
Merge pull request #28570 from storybookjs/norbert/cpc-alias-for-them…
Browse files Browse the repository at this point in the history
…ing-create

CPC: Add `theming/create` aliases in docs preset
  • Loading branch information
shilman authored Jul 12, 2024
2 parents f0c74cb + 0f9b105 commit 5cb6c6e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions code/addons/docs/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ async function webpack(
*/
const cliPath = require.resolve('storybook/package.json');
const themingPath = join(cliPath, '..', 'core', 'theming', 'index.js');
const themingCreatePath = join(cliPath, 'core', 'theming', 'create.js');

const componentsPath = join(cliPath, '..', 'core', 'components', 'index.js');
const blocksPath = dirname(require.resolve('@storybook/blocks/package.json'));
if (Array.isArray(webpackConfig.resolve?.alias)) {
Expand All @@ -87,6 +89,10 @@ async function webpack(
name: '@mdx-js/react',
alias: mdx,
},
{
name: '@storybook/theming/create',
alias: themingCreatePath,
},
{
name: '@storybook/theming',
alias: themingPath,
Expand All @@ -104,6 +110,7 @@ async function webpack(
alias = {
...webpackConfig.resolve?.alias,
react,
'@storybook/theming/create': themingCreatePath,
'@storybook/theming': themingPath,
'@storybook/components': componentsPath,
'@storybook/blocks': blocksPath,
Expand Down Expand Up @@ -168,6 +175,7 @@ export const viteFinal = async (config: any, options: Options) => {

const cliPath = dirname(require.resolve('storybook/package.json'));
const themingPath = join(cliPath, 'core', 'theming', 'index.js');
const themingCreatePath = join(cliPath, 'core', 'theming', 'create.js');
const componentsPath = join(cliPath, 'core', 'components', 'index.js');
const blocksPath = dirname(require.resolve('@storybook/blocks/package.json'));

Expand All @@ -187,6 +195,7 @@ export const viteFinal = async (config: any, options: Options) => {
*
* In the future the `@storybook/theming` and `@storybook/components` can be removed, as they should be singletons in the future due to the peerDependency on `storybook` package.
*/
'@storybook/theming/create': themingCreatePath,
'@storybook/theming': themingPath,
'@storybook/components': componentsPath,
'@storybook/blocks': blocksPath,
Expand Down

0 comments on commit 5cb6c6e

Please sign in to comment.