forked from jupyterlab/jupyterlab
/
webpack.config.js
36 lines (34 loc) · 1005 Bytes
/
webpack.config.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
36
const path = require('path');
const SRC_PATH = path.join(__dirname, '../src');
const STORIES_PATH = path.join(__dirname, '../stories');
const STYLE_PATH = path.resolve(__dirname, '../style');
//dont need stories path if you have your stories inside your src folder
module.exports = ({ config }) => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
include: [SRC_PATH, STORIES_PATH],
use: [
{
loader: require.resolve('awesome-typescript-loader'),
options: {
configFileName: './.storybook/tsconfig.json'
}
},
{ loader: require.resolve('react-docgen-typescript-loader') }
]
});
const fileLoaderRule = config.module.rules.find(rule =>
rule.test.test('.svg')
);
fileLoaderRule.exclude = STYLE_PATH;
config.module.rules.push({
test: /\.svg$/,
include: STYLE_PATH,
// issuer: { test: /\.ts$/ },
use: {
loader: 'raw-loader'
}
});
config.resolve.extensions.push('.ts', '.tsx');
return config;
};