2017-12-20 15:22:08 +11:00
|
|
|
const path = require('path');
|
2018-04-21 19:19:05 +03:00
|
|
|
const { DefinePlugin } = require('webpack');
|
2017-12-20 15:22:08 +11:00
|
|
|
|
2018-04-21 19:19:05 +03:00
|
|
|
module.exports = (baseConfig, env, defaultConfig) => ({
|
|
|
|
...defaultConfig,
|
2018-02-17 16:40:51 +02:00
|
|
|
module: {
|
2018-04-21 19:19:05 +03:00
|
|
|
...defaultConfig.module,
|
2018-02-17 16:40:51 +02:00
|
|
|
rules: [
|
2018-04-21 19:19:05 +03:00
|
|
|
...defaultConfig.module.rules,
|
2018-02-17 16:40:51 +02:00
|
|
|
{
|
|
|
|
test: /\.stories\.jsx?$/,
|
|
|
|
loaders: [require.resolve('@storybook/addon-storysource/loader')],
|
|
|
|
include: [
|
|
|
|
path.resolve(__dirname, './stories'),
|
|
|
|
path.resolve(__dirname, '../../lib/ui/src'),
|
|
|
|
path.resolve(__dirname, '../../lib/components/src'),
|
|
|
|
],
|
|
|
|
enforce: 'pre',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.js/,
|
|
|
|
loaders: ['babel-loader'],
|
|
|
|
include: [
|
|
|
|
path.resolve(__dirname, '../../lib/ui/src'),
|
|
|
|
path.resolve(__dirname, '../../lib/components/src'),
|
|
|
|
],
|
|
|
|
},
|
2018-01-31 14:54:29 +02:00
|
|
|
],
|
2018-02-17 16:40:51 +02:00
|
|
|
},
|
2018-04-21 19:19:05 +03:00
|
|
|
resolve: {
|
|
|
|
...defaultConfig.resolve,
|
|
|
|
// https://github.com/graphql/graphql-js#using-in-a-browser
|
|
|
|
extensions: ['.mjs', ...defaultConfig.resolve.extensions],
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
...defaultConfig.plugins,
|
|
|
|
// graphql sources check process variable
|
|
|
|
new DefinePlugin({
|
|
|
|
process: JSON.stringify(true),
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
});
|