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