-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: switch to storybook config from visyn_scripts (#127)
Switch to storybook config from visyn_scripts
- Loading branch information
1 parent
8080368
commit 401602e
Showing
1 changed file
with
1 addition
and
41 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
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 }); |