All files / .storybook main.js

25% Statements 2/8
0% Branches 0/2
0% Functions 0/1
25% Lines 2/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 871x 1x                                                                                                                                                                          
const path = require("path")
module.exports = {
  "stories": [
    "../src/**/*.stories.mdx",
    "../src/**/*.stories.@(js|jsx|ts|tsx)"
  ],
  "addons": [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    '@storybook/addon-actions',
    '@storybook/addon-knobs',
    '@storybook/addon-docs',
    '@storybook/addon-a11y',
    '@storybook/addon-controls',
    '@storybook/addon-interactions',
    "@storybook/addon-viewport",
    "@storybook/addon-storysource",
  ],
  "staticDirs": ["../static"],
  "framework": "@storybook/react",
  webpackFinal: async (config) => {
    // https://github.com/gatsbyjs/gatsby/discussions/36293
    config.externals = ["react-dom/client"]
    // Transpile Gatsby module because Gatsby includes un-transpiled ES6 code.
    config.module.rules[0].exclude = [/node_modules\/(?!(gatsby)\/)/]
    // Use babel-plugin-remove-graphql-queries to remove static queries from components when rendering in storybook
    config.module.rules[0].use[0].options.plugins.push([
        require.resolve("babel-plugin-remove-graphql-queries"),
      {
        stage: config.mode === `development` ? "develop-html" : "build-html",
        staticQueryDir: "page-data/sq/d",
      },
    ])
 
    config.module.rules.push({
      test: /\.module\.scss$/,
      use: [
        {
          loader: "style-loader",
          options: {
            modules: {
              // for use CSS module in Storybook, namedExport is true.
              namedExport: true,
            },
          },
        },
        {
          loader: "css-loader",
          options: {
            importLoaders: 1,
            modules: {
              // for use CSS module in Storybook, namedExport is true.
              namedExport: true,
            }
          },
        },
        "sass-loader",
      ],
      include: path.resolve(__dirname, '../'),
    })
    config.module.rules.push({
      test: /\.scss$/,
      use: [
        "style-loader",
        {
          loader: "css-loader",
          options: {
            modules: {
              auto: true,
            }
          }
        },
        "sass-loader",
      ],
      include: path.resolve(__dirname, '../'),
      exclude: /\.module\.scss$/
    })
    return config
  },
  features: {
    interactionsDebugger: true,
  },
  core: {
    builder: "@storybook/builder-webpack5"
  },
}