2021-04-28 21:53:59 +02:00
|
|
|
const path = require('path');
|
2020-11-30 21:10:46 +01:00
|
|
|
|
2021-04-28 21:53:59 +02:00
|
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
2020-11-30 21:10:46 +01:00
|
|
|
|
2022-09-20 19:15:14 +02:00
|
|
|
const { generateIconNames } = require('../development/generate-icon-names');
|
|
|
|
|
2020-02-26 14:34:59 +01:00
|
|
|
module.exports = {
|
2022-01-07 21:30:37 +01:00
|
|
|
stories: [
|
|
|
|
'../ui/**/*.stories.js',
|
|
|
|
'../ui/**/*.stories.mdx',
|
|
|
|
'./*.stories.mdx',
|
|
|
|
],
|
2020-02-26 14:34:59 +01:00
|
|
|
addons: [
|
2021-10-29 19:22:07 +02:00
|
|
|
'@storybook/addon-essentials',
|
2020-02-26 14:34:59 +01:00
|
|
|
'@storybook/addon-actions',
|
2021-10-29 19:22:07 +02:00
|
|
|
'@storybook/addon-a11y',
|
|
|
|
'@storybook/addon-knobs',
|
2021-02-08 16:45:06 +01:00
|
|
|
'./i18n-party-addon/register.js',
|
2022-02-25 23:11:22 +01:00
|
|
|
'storybook-dark-mode',
|
2020-02-26 14:34:59 +01:00
|
|
|
],
|
2022-09-07 00:58:22 +02:00
|
|
|
staticDirs: ['../app', './images'],
|
2021-10-29 19:22:07 +02:00
|
|
|
// Uses babel.config.js settings and prevents "Missing class properties transform" error
|
|
|
|
babel: async (options) => ({ overrides: options.overrides }),
|
2022-09-20 19:15:14 +02:00
|
|
|
// Sets env variables https://storybook.js.org/docs/react/configure/environment-variables/
|
|
|
|
env: async (config) => {
|
|
|
|
return {
|
|
|
|
...config,
|
|
|
|
// Creates the icon names environment variable for the component-library/icon/icon.js component
|
|
|
|
ICON_NAMES: await generateIconNames(),
|
|
|
|
};
|
|
|
|
},
|
2020-11-30 21:10:46 +01:00
|
|
|
webpackFinal: async (config) => {
|
2021-10-29 19:22:07 +02:00
|
|
|
config.context = process.cwd();
|
2021-09-15 20:55:48 +02:00
|
|
|
config.node = {
|
2021-10-29 19:22:07 +02:00
|
|
|
__filename: true,
|
|
|
|
};
|
2022-09-07 00:58:22 +02:00
|
|
|
config.resolve.alias['webextension-polyfill'] = require.resolve(
|
|
|
|
'./__mocks__/webextension-polyfill.js',
|
|
|
|
);
|
2021-04-28 21:53:59 +02:00
|
|
|
config.module.strictExportPresence = true;
|
2020-11-30 21:10:46 +01:00
|
|
|
config.module.rules.push({
|
|
|
|
test: /\.scss$/,
|
|
|
|
loaders: [
|
|
|
|
'style-loader',
|
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: {
|
|
|
|
import: false,
|
|
|
|
url: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'sass-loader',
|
|
|
|
options: {
|
|
|
|
sourceMap: true,
|
2021-01-19 17:54:32 +01:00
|
|
|
implementation: require('sass'),
|
2021-01-20 16:58:03 +01:00
|
|
|
sassOptions: {
|
2021-04-28 21:53:59 +02:00
|
|
|
includePaths: ['ui/css/'],
|
2021-01-20 16:58:03 +01:00
|
|
|
},
|
2020-11-30 21:10:46 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2021-04-28 21:53:59 +02:00
|
|
|
});
|
2021-01-19 17:54:32 +01:00
|
|
|
config.plugins.push(
|
|
|
|
new CopyWebpackPlugin({
|
|
|
|
patterns: [
|
|
|
|
{
|
|
|
|
from: path.join(
|
|
|
|
'node_modules',
|
|
|
|
'@fortawesome',
|
|
|
|
'fontawesome-free',
|
|
|
|
'webfonts',
|
|
|
|
),
|
|
|
|
to: path.join('fonts', 'fontawesome'),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}),
|
2021-04-28 21:53:59 +02:00
|
|
|
);
|
|
|
|
return config;
|
2020-11-30 21:10:46 +01:00
|
|
|
},
|
2021-04-28 21:53:59 +02:00
|
|
|
};
|