/
main.js
35 lines (29 loc) · 1.09 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const path = require('path');
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
module.exports = {
webpackFinal: async (config) => {
let updatedConfig = { ...config };
// below we are removing fork-ts-checker-webpack-plugin to ignore typescript error while building storybook
// find fork-ts-checker-webpack-plugin
const tsCheckerIndex = config.plugins.findIndex((item) => {
return 'tslint' in item && 'typescript' in item;
});
const plugins = [...updatedConfig.plugins];
plugins.splice(tsCheckerIndex, 1);
// allow absolute import
updatedConfig.resolve.modules = [...(updatedConfig.resolve.modules || []), path.resolve(__dirname, '../../')];
return {
...updatedConfig,
// we are using NodePolyfillPlugin to support node polyfill in webpack 5
plugins: [...plugins, new NodePolyfillPlugin()],
};
},
stories: ['../**/*.stories.mdx', '../**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
features: {
babelModeV7: true,
},
core: {
builder: 'webpack5',
},
};