🚀

【Storybook】tsconfigに設定したpathsに対応させる

2023/03/29に公開

Condition

  • Next.js 13
  • Storybook v6

Setting

.storybook/main.js
const path = require('path')

module.exports = {
...
  // @see https://github.com/storybookjs/storybook/issues/3916#issuecomment-871283551
  webpackFinal(config) {
    config.resolve.alias = {
      ...config.resolve.alias,
      '@': path.resolve(__dirname, '../src'),
    }
    return config;
  },
};

Refs

https://github.com/storybookjs/storybook/issues/3916#issuecomment-871283551

Discussion