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

65 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-01-09 02:40:57 -06:00
const path = require('path');
module.exports = (baseConfig, env, config) => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
use: [
{
loader: require.resolve('awesome-typescript-loader'),
},
],
});
2019-01-09 02:40:57 -06:00
config.module.rules.push({
test: /\.scss$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
importLoaders: 2,
url: false,
sourceMap: false,
minimize: false,
},
},
{
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: {
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');
2019-02-06 10:03:42 -06:00
// Remove pure js loading rules as Storybook's Babel config is causing problems when mixing ES6 and CJS
// More about the problem we encounter: https://github.com/webpack/webpack/issues/4039
config.module.rules = config.module.rules.filter(rule => rule.test.toString() !== /\.(mjs|jsx?)$/.toString());
2019-01-09 02:40:57 -06:00
return config;
};