fbredius/storybook

View on GitHub
lib/builder-webpack4/src/preview/babel-loader-preview.ts

Summary

Maintainability
A
2 hrs
Test Coverage
import { getProjectRoot } from '@storybook/core-common';
import { useBaseTsSupport } from './useBaseTsSupport';

export const createBabelLoader = (options: any, framework: string) => ({
  test: useBaseTsSupport(framework) ? /\.(mjs|tsx?|jsx?)$/ : /\.(mjs|jsx?)$/,
  use: [
    {
      loader: require.resolve('babel-loader'),
      options,
    },
  ],
  include: [getProjectRoot()],
  exclude: /node_modules/,
});