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

Addon-docs: Resolve babel-loader from storybook/core #13607

Merged
merged 1 commit into from
Jan 11, 2021
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
12 changes: 8 additions & 4 deletions addons/docs/src/frameworks/common/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import remarkExternalLinks from 'remark-external-links';
// @ts-ignore
import createCompiler from '../../mdx/mdx-compiler-plugin';

const resolvedBabelLoader = require.resolve('babel-loader', {
paths: [require.resolve('@storybook/core')],
});

// 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'
Expand Down Expand Up @@ -66,7 +70,7 @@ export function webpack(webpackConfig: any = {}, options: any = {}) {
test: /\.md$/,
use: [
{
loader: require.resolve('babel-loader'),
loader: resolvedBabelLoader,
options: createBabelOptions({ babelOptions, mdxBabelOptions, configureJSX }),
},
{
Expand All @@ -89,7 +93,7 @@ export function webpack(webpackConfig: any = {}, options: any = {}) {
include: new RegExp(`node_modules\\${path.sep}acorn-jsx`),
use: [
{
loader: require.resolve('babel-loader'),
loader: resolvedBabelLoader,
options: {
presets: [[require.resolve('@babel/preset-env'), { modules: 'commonjs' }]],
},
Expand All @@ -100,7 +104,7 @@ export function webpack(webpackConfig: any = {}, options: any = {}) {
test: /\.(stories|story)\.mdx$/,
use: [
{
loader: require.resolve('babel-loader'),
loader: resolvedBabelLoader,
options: createBabelOptions({ babelOptions, mdxBabelOptions, configureJSX }),
},
{
Expand All @@ -117,7 +121,7 @@ export function webpack(webpackConfig: any = {}, options: any = {}) {
exclude: /\.(stories|story)\.mdx$/,
use: [
{
loader: require.resolve('babel-loader'),
loader: resolvedBabelLoader,
options: createBabelOptions({ babelOptions, mdxBabelOptions, configureJSX }),
},
{
Expand Down