Skip to content

Commit

Permalink
fix: switch to storybook config from visyn_scripts (#127)
Browse files Browse the repository at this point in the history
Switch to storybook config from visyn_scripts
  • Loading branch information
puehringer authored Dec 1, 2023
1 parent 8080368 commit 401602e
Showing 1 changed file with 1 addition and 41 deletions.
42 changes: 1 addition & 41 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,41 +1 @@
const path = require('path');
module.exports = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/preset-scss',
'storybook-addon-swc',
'@storybook/addon-mdx-gfm',
],
framework: {
name: '@storybook/react-webpack5',
options: {},
},
webpackFinal: async (config) => {
// TODO:: Setting minimize here because storybook fails on prod otherwise. Specifically, we get arquero errors along the lines of "Invalid variable reference: "a"".
// This same problem does not occur on our prod builds, only for this storybook webpack compiler
config.optimization.minimize = false;
// This is required to enable TS moduleResolution: node16, as there we have to add .js extensions which are actually .ts files.
(config.resolve.extensionAlias = {
...(config.resolve.extensionAlias || {}),
'.js': ['.tsx', '.ts', '.js'],
'.cjs': ['.cts', '.cjs'],
'.mjs': ['.mts', '.mjs'],
}),
(config.resolve.alias = {
...(config.resolve.alias || {}),
// I have no clue why this is required, but if this is missing we get a "Can't resolve '../../assets/icons/datavisyn_logo.svg' in '.../src/scss'""
'../../assets': path.resolve(__dirname, '../src/assets'),
// Add visyn_core/dist as alias, as we have scss/code imports like visyn_core/dist/assets/...
'visyn_core/dist': path.resolve(__dirname, '../src'),
'visyn_core/src': path.resolve(__dirname, '../src'),
visyn_core: path.resolve(__dirname, '../src'),
});
return config;
},
docs: {
autodocs: true,
},
};
module.exports = require('visyn_scripts/config/storybook.main.template')({ name: 'visyn_core', dirname: __dirname });

0 comments on commit 401602e

Please sign in to comment.