-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23020 from noviceGuru/next
Added `@` import to Webpack config, without needing a package
- Loading branch information
Showing
5 changed files
with
71 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
docs/snippets/common/storybook-main-ts-module-resolution-atsign-import.js.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
```js | ||
// .storybook/main.js | ||
|
||
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'; | ||
|
||
export default { | ||
// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite) | ||
framework: '@storybook/your-framework', | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], | ||
webpackFinal: async (config) => { | ||
if (config.resolve) { | ||
config.resolve.alias = { | ||
...config.resolve.alias, | ||
'@': path.resolve(__dirname, '../src'), | ||
}; | ||
} | ||
return config; | ||
}, | ||
}; | ||
``` |
22 changes: 22 additions & 0 deletions
22
docs/snippets/common/storybook-main-ts-module-resolution-atsign-import.ts.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
```ts | ||
// .storybook/main.ts | ||
|
||
// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite) | ||
import type { StorybookConfig } from '@storybook/your-framework'; | ||
|
||
const config: StorybookConfig = { | ||
framework: '@storybook/your-framework', | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], | ||
webpackFinal: async (config) => { | ||
if (config.resolve) { | ||
config.resolve.alias = { | ||
...config.resolve.alias, | ||
'@': path.resolve(__dirname, '../src'), | ||
}; | ||
} | ||
return config; | ||
}, | ||
}; | ||
|
||
export default config; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters