I'm having a really hard time in trying to get a path to resolve. See the end for the error:
My storybook main.js:
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin').default;
const path = require('path');
module.exports = {
stories: ['../src/**/*.story.@(js|jsx|ts|tsx)'],
addons: [
'storybook-dark-mode',
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
{
name: '@storybook/addon-postcss',
options: {
postcssLoaderOptions: {
implementation: require('postcss'),
},
},
},
],
framework: '@storybook/react',
core: {
builder: '@storybook/builder-webpack5',
},
webpackFinal: async (config) => {
config.resolve = {
...config.resolve,
alias: {
...(config.resolve.alias || []),
'@/panda/css': path.resolve(__dirname, '../styled-system/css'),
'@/panda/jsx': path.resolve(__dirname, '../styled-system/jsx'),
},
plugins: [
...(config.resolve.plugins || []),
new TsconfigPathsPlugin({
extensions: ['.ts', '.tsx', '.js'],
configFile: path.join(__dirname, '../tsconfig.json'),
}),
],
};
// Turn off docgen plugin as it breaks bundle with displayName
config.plugins.pop();
return config;
},
};
My tsconfig.json:
{
"extends": "../../tsconfig.base.json",
"include": ["./src", "../../configuration/types"],
"exclude": ["./src/project-core/lib/*.d.ts"],
"compilerOptions": {
"rootDir": "src",
"baseUrl": ".",
"outDir": "lib",
"declaration": true,
"declarationDir": "lib",
"composite": true,
"strict": true,
"importHelpers": true,
// "moduleResolution": "Node",
"paths": {
"@/panda/css": ["../../styled-system/css"],
"@/panda/jsx": ["../../styled-system/jsx"],
}
},
"references": [],
}