grafana/packages/grafana-ui/.storybook/webpack.config.js

82 lines
1.8 KiB
JavaScript
Raw Normal View History

2019-01-09 02:40:57 -06:00
const path = require('path');
module.exports = ({ config, mode }) => {
config.module.rules = [
...(config.module.rules || []),
{
test: /\.tsx?$/,
use: [
{
loader: require.resolve('ts-loader'),
options: {
// transpileOnly: true,
configFile: path.resolve(__dirname, '../tsconfig.json'),
},
},
{
loader: require.resolve('react-docgen-typescript-loader'),
options: {
tsconfigPath: path.resolve(__dirname, '../tsconfig.json'),
// https://github.com/styleguidist/react-docgen-typescript#parseroptions
// @ts-ignore
propFilter: prop => {
if (prop.parent) {
return !prop.parent.fileName.includes('node_modules/@types/react/');
}
2019-01-09 02:40:57 -06:00
return true;
},
},
},
],
},
];
2019-01-09 02:40:57 -06:00
config.module.rules.push({
test: /\.scss$/,
use: [
{
2019-03-21 10:06:55 -05:00
loader: 'style-loader/useable',
2019-01-09 02:40:57 -06:00
},
{
loader: 'css-loader',
options: {
importLoaders: 2,
},
},
{
loader: 'postcss-loader',
options: {
sourceMap: false,
config: { path: __dirname + '../../../../scripts/webpack/postcss.config.js' },
},
},
2019-02-06 10:03:42 -06:00
{
loader: 'sass-loader',
options: {
2019-03-21 10:06:55 -05:00
sourceMap: false,
2019-02-06 10:03:42 -06:00
},
},
2019-01-09 02:40:57 -06:00
],
});
config.module.rules.push({
test: require.resolve('jquery'),
use: [
{
loader: 'expose-loader',
query: 'jQuery',
},
{
loader: 'expose-loader',
query: '$',
},
],
});
2019-01-09 02:40:57 -06:00
config.resolve.extensions.push('.ts', '.tsx');
config.stats = {
warningsFilter: /export .* was not found in/,
};
2019-01-09 02:40:57 -06:00
return config;
};