2021-03-03 07:52:29 -05:00
|
|
|
const path = require('path')
|
|
|
|
|
|
|
|
// NOTE: must be set before webpack config is imported
|
|
|
|
process.env.SHARELATEX_CONFIG = path.resolve(
|
|
|
|
__dirname,
|
2021-05-19 08:07:10 -04:00
|
|
|
'../config/settings.webpack.js'
|
2021-03-03 07:52:29 -05:00
|
|
|
)
|
|
|
|
|
2020-09-25 04:40:19 -04:00
|
|
|
const customConfig = require('../webpack.config.dev')
|
|
|
|
|
|
|
|
module.exports = {
|
2021-03-03 07:52:29 -05:00
|
|
|
stories: [
|
|
|
|
'../frontend/stories/**/*.stories.js',
|
2021-04-27 03:52:58 -04:00
|
|
|
'../modules/**/stories/**/*.stories.js',
|
2021-03-03 07:52:29 -05:00
|
|
|
],
|
2020-09-25 04:40:19 -04:00
|
|
|
addons: ['@storybook/addon-essentials', '@storybook/addon-a11y'],
|
|
|
|
webpackFinal: storybookConfig => {
|
|
|
|
// Combine Storybook's webpack loaders with our webpack loaders
|
|
|
|
const rules = [
|
|
|
|
// Filter out the Storybook font file loader, which overrides our font
|
|
|
|
// file loader causing the font to fail to load
|
|
|
|
...storybookConfig.module.rules.filter(
|
|
|
|
rule => !rule.test.toString().includes('woff')
|
|
|
|
),
|
2021-02-09 10:39:29 -05:00
|
|
|
// Replace the less rule, adding to-string-loader
|
2021-03-18 05:52:36 -04:00
|
|
|
// Filter out the MiniCSS extraction, which conflicts with the built-in CSS loader
|
2021-02-09 10:39:29 -05:00
|
|
|
...customConfig.module.rules.filter(
|
2021-03-18 05:52:36 -04:00
|
|
|
rule =>
|
|
|
|
!rule.test.toString().includes('less') &&
|
|
|
|
!rule.test.toString().includes('css')
|
2021-02-09 10:39:29 -05:00
|
|
|
),
|
|
|
|
{
|
|
|
|
test: /\.less$/,
|
2021-04-27 03:52:58 -04:00
|
|
|
use: ['to-string-loader', 'css-loader', 'less-loader'],
|
|
|
|
},
|
2020-09-25 04:40:19 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
// Combine Storybook's webpack plugins with our webpack plugins
|
|
|
|
const plugins = [...storybookConfig.plugins, ...customConfig.plugins]
|
|
|
|
|
|
|
|
return {
|
|
|
|
...storybookConfig,
|
|
|
|
module: {
|
|
|
|
...storybookConfig.module,
|
2021-04-27 03:52:58 -04:00
|
|
|
rules,
|
2020-09-25 04:40:19 -04:00
|
|
|
},
|
2021-04-27 03:52:58 -04:00
|
|
|
plugins,
|
2020-09-25 04:40:19 -04:00
|
|
|
}
|
2021-04-27 03:52:58 -04:00
|
|
|
},
|
2020-09-25 04:40:19 -04:00
|
|
|
}
|