Skip to content

Commit

Permalink
fix: webpack configs inherit mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Jun 26, 2020
1 parent d2d968f commit 826c1b8
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 19 deletions.
34 changes: 16 additions & 18 deletions core/webpack-configs/src/instrument/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,23 @@ export const instrument: Configuration = {
{
test: /\.(md|mdx)$/,
exclude: [/node_modules/],
use: [
{
loader: 'babel-loader',
options: {
presets: [
[require.resolve('@babel/preset-env'), { modules: 'commonjs' }],
require.resolve('@babel/preset-react'),
],
},
},
{
loader: '@component-controls/loader/loader',
options: {
mdx: {
transformMDX: true,
},
},
loader: 'babel-loader',
options: {
presets: [
[require.resolve('@babel/preset-env'), { modules: 'commonjs' }],
require.resolve('@babel/preset-react'),
],
},
},
{
test: /\.(md|mdx)$/,
exclude: [/node_modules/],
loader: '@component-controls/loader/loader',
options: {
mdx: {
transformMDX: true,
},
],
},
},
{
test: /\.(story|stories).(js|jsx|ts|tsx)$/,
Expand Down
18 changes: 18 additions & 0 deletions core/webpack-configs/src/react-docgen-typescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@ import { Configuration } from 'webpack';
export const reactDocgenTypescript: Configuration = {
module: {
rules: [
{
test: /\.(md|mdx)$/,
exclude: [/node_modules/],
loader: '@component-controls/loader/loader',
options: {
propsLoaders: [
{
name: '@component-controls/react-docgen-info',
test: /\.(js|jsx)$/,
},
{
name: '@component-controls/react-docgen-typescript-info',
test: /\.(ts|tsx)$/,
},
],
},
},

{
test: /\.(story|stories).(js|jsx|ts|tsx|mdx)$/,
loader: '@component-controls/loader/loader',
Expand Down
15 changes: 14 additions & 1 deletion core/webpack-configs/src/react-docgen/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@ export const reactDocgen: Configuration = {
module: {
rules: [
{
test: /\.(story|stories).(js|jsx|ts|tsx|mdx)$/,
test: /\.(md|mdx)$/,
exclude: [/node_modules/],
loader: '@component-controls/loader/loader',
options: {
propsLoaders: [
{
name: '@component-controls/react-docgen-info',
test: /\.(js|jsx|ts|tsx)$/,
},
],
},
},
{
test: /\.(story|stories).(js|jsx|ts|tsx)$/,
loader: '@component-controls/loader/loader',
exclude: [/node_modules/],
enforce: 'pre',
Expand Down

0 comments on commit 826c1b8

Please sign in to comment.