Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDX: Don't use root babelrc by default #11185

Merged
merged 1 commit into from
Jun 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions addons/docs/src/frameworks/common/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ const context = coreDirName.includes('node_modules')
: path.join(coreDirName, '../../node_modules'); // SB Monorepo

function createBabelOptions(babelOptions?: any, configureJSX?: boolean) {
if (!configureJSX) {
return babelOptions;
}

// for frameworks that are not working with react, we need to configure
// the jsx to transpile mdx, for now there will be a flag for that
// for more complex solutions we can find alone that we need to add '@babel/plugin-transform-react-jsx'
const babelPlugins = (babelOptions && babelOptions.plugins) || [];
const plugins = configureJSX
? [...babelPlugins, '@babel/plugin-transform-react-jsx']
: babelPlugins;

return {
// don't use the root babelrc by default (users can override this in babelOptions)
babelrc: false,
...babelOptions,
// for frameworks that are not working with react, we need to configure
// the jsx to transpile mdx, for now there will be a flag for that
// for more complex solutions we can find alone that we need to add '@babel/plugin-transform-react-jsx'
plugins: [...babelPlugins, '@babel/plugin-transform-react-jsx'],
plugins,
};
}

Expand Down