question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix the a11y addon

See original GitHub issue

@storybook/addon-a11y error

a11yRunner.js:10 Uncaught SyntaxError: The requested module '/@fs/Users/zander/code/my/project/node_modules/@storybook/addon-a11y/node_modules/axe-core/axe.js?v=ad04bc2d' does not provide an export named 'default'

_Originally posted by @mrmartineau in https://github.com/eirslett/storybook-builder-vite/issues/4#issuecomment-822373486_

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
IanVScommented, Jun 13, 2021

Cool, I was able to simplify my config greatly:

async viteFinal(config) {
  return {
    ...config,
    // Use our standard cache dir, to make it easy to clear
    cacheDir: path.resolve(__dirname, '../node_modules/.cache/vite'),
    optimizeDeps: {
      ...config.optimizeDeps,
      // Entries are specified relative to the root
      entries: [`${path.relative(config.root, path.resolve(__dirname, '../src'))}/**/*.stories.tsx`],
      include: [...config.optimizeDeps.include, 'storybook-dark-mode'],
    },
  };
},

I’ll close out the issue, but let us know if you have any other trouble. Glad it seems to be working for you now.

1reaction
IanVScommented, Jun 11, 2021

I haven’t quite cleaned this up all the way, but here’s the viteFinal that I ended up with in my own project. You may not need all of it, but hopefully it’s a start:

async viteFinal(config) {
    return {
      ...config,
      // Use the standard cache dir, to make it easy to clear
      cacheDir: path.resolve(__dirname, '../node_modules/.vite'),
      optimizeDeps: {
        // This is relative to the root, which is buried in node_modules.
        entries: ['../../../**/*.stories.tsx'],
        include: [
          'axe-core',
          'acorn-jsx',
          '@mdx-js/react',
          '@storybook/addon-actions',
          '@storybook/addon-docs',
          '@storybook/addon-docs/blocks',
          '@storybook/addons',
          '@storybook/client-api',
          '@storybook/client-logger',
          '@storybook/csf',
          '@storybook/react',
          '@storybook/testing-react',
          'classnames',
          'deep-object-diff',
          'doctrine',
          'escodegen',
          'fast-deep-equal',
          'global',
          'hoist-non-react-statics',
          'html-tags',
          'lodash/cloneDeep',
          'lodash/isFunction',
          'lodash/isPlainObject',
          'lodash/isString',
          'lodash/mapValues',
          'lodash/pickBy',
          'lodash/uniq',
          'memoizerific',
          'prop-types',
          'storybook-dark-mode',
          'ts-dedent',
          'qs',
          'util-deprecate',
          'uuid-browser/v4',
        ],
      },
    };
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix the a11y addon · Issue #6 · storybookjs/builder-vite - GitHub
It could be related to cjs/esm module issues. Maybe it's including axe.js directly instead of including axe-core?
Read more >
Storybook-addon-a11y - Accessibility
Test component compliance with web accessibility standards. ... This Storybook addon can be helpful to make your UI components more accessible.
Read more >
@storybook/addon-a11y - npm
@storybook/addon-a11y. TypeScript icon, indicating that this package has built-in type declarations. 6.5.15 • Public • Published 6 days ago.
Read more >
React Storybook Tutorial - 12 - a11y Addon - YouTube
Courses - https://learn.codevolution.dev/ Support UPI - https://support.codevolution.dev/ Support PayPal ...
Read more >
WP Accessibility – WordPress plugin
This plug-in helps with a variety of common accessibility problems in WordPress themes. While most accessibility issues can't be addressed without directly ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found