const path = require('path') const withMDX = require('next-mdx-frontmatter')({ extension: /\.mdx?$/ }) const e = withMDX({ pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'] }) module.exports = { ...e, webpack(...args) { const oldWebpack = e.webpack(...args) const [config, { defaultLoaders, }] = args config.module.rules.push({ test: /\.(ts|tsx)$/, include: [path.resolve(__dirname, '../react-common/')], use: [defaultLoaders.babel], }) return oldWebpack } }