From 91f3d51b9be68dbb05d67de1d679d361b4f8d475 Mon Sep 17 00:00:00 2001 From: Jason Zhu Date: Wed, 22 Mar 2023 21:29:42 +1100 Subject: [PATCH] Configured storybook --- .storybook/main.js | 13 ++++++++++++- package.json | 1 + yarn.lock | 20 +++++++++++++++++++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/.storybook/main.js b/.storybook/main.js index 234079d..3ca8841 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -1,5 +1,7 @@ +const path = require('path'); +const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); module.exports = { - stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], + stories: ['../src/**/*.stories.tsx'], addons: [ '@storybook/addon-links', '@storybook/addon-essentials', @@ -10,4 +12,13 @@ module.exports = { core: { builder: '@storybook/builder-webpack5', }, + webpackFinal: async config => { + config.resolve.plugins = config.resolve.plugins || []; + config.resolve.plugins = [ + new TsconfigPathsPlugin({ + configFile: path.resolve(__dirname, '../tsconfig.json'), + }), + ]; + return config; + }, }; diff --git a/package.json b/package.json index ab3b63b..0fd4d85 100644 --- a/package.json +++ b/package.json @@ -85,6 +85,7 @@ "lint-staged": "^13.2.0", "prettier": "^2.8.4", "prop-types": "^15.8.1", + "tsconfig-paths-webpack-plugin": "^4.0.1", "webpack": "^5.76.2" } } diff --git a/yarn.lock b/yarn.lock index fe6cfe7..d80c921 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6460,7 +6460,7 @@ enhanced-resolve@^4.5.0: memory-fs "^0.5.0" tapable "^1.0.0" -enhanced-resolve@^5.10.0: +enhanced-resolve@^5.10.0, enhanced-resolve@^5.7.0: version "5.12.0" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz#300e1c90228f5b570c4d35babf263f6da7155634" integrity sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ== @@ -13965,6 +13965,15 @@ ts-pnp@^1.1.6: resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92" integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw== +tsconfig-paths-webpack-plugin@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/tsconfig-paths-webpack-plugin/-/tsconfig-paths-webpack-plugin-4.0.1.tgz#a24651d0f69668a1abad38d3c2489855c257460d" + integrity sha512-m5//KzLoKmqu2MVix+dgLKq70MnFi8YL8sdzQZ6DblmCdfuq/y3OqvJd5vMndg2KEVCOeNz8Es4WVZhYInteLw== + dependencies: + chalk "^4.1.0" + enhanced-resolve "^5.7.0" + tsconfig-paths "^4.1.2" + tsconfig-paths@^3.14.1: version "3.14.2" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088" @@ -13975,6 +13984,15 @@ tsconfig-paths@^3.14.1: minimist "^1.2.6" strip-bom "^3.0.0" +tsconfig-paths@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-4.1.2.tgz#4819f861eef82e6da52fb4af1e8c930a39ed979a" + integrity sha512-uhxiMgnXQp1IR622dUXI+9Ehnws7i/y6xvpZB9IbUVOPy0muvdvgXeZOn88UcGPiT98Vp3rJPTa8bFoalZ3Qhw== + dependencies: + json5 "^2.2.2" + minimist "^1.2.6" + strip-bom "^3.0.0" + tslib@^1.8.1, tslib@^1.9.3: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"