- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 9.8k
Open
Description
Describe the bug
I've managed to get syntax highlighting for SCSS to work by adapting the code from this comment: #25307 (comment)
import type { Preview } from '@storybook/react-vite';
import { SyntaxHighlighter } from 'storybook/internal/components';
import scss from 'react-syntax-highlighter/dist/cjs/languages/prism/scss';A few days ago, react-syntax-highlighter has published a new major version (v16) to address security vulnerabilities related to a dated version of refractor.
However, upon upgrading to v16, any attempts to serve or build storybook will fail with this message:
Could not resolve "refractor/lang/scss.js"
node_modules/react-syntax-highlighter/dist/cjs/languages/prism/scss.js:8:43:
  8 │ var _scss = _interopRequireDefault(require("refractor/lang/scss.js"));
    ╵                                            ~~~~~~~~~~~~~~~~~~~~~~~~
The module "./lang/lang/scss.js.js" was not found on the file system:
node_modules/refractor/package.json:47:11:
  47 │     "./*": "./lang/*.js"
Reproduction link
https://stackblitz.com/edit/github-m92phszh
Reproduction steps
- 
Install latest version of react-syntax-highlight@^16
- 
Add the following to preview.ts:import scss from 'react-syntax-highlighter/dist/cjs/languages/prism/scss'; import { SyntaxHighlighter } from 'storybook/internal/components'; SyntaxHighlighter.registerLanguage('scss', scss); 
- 
Try to serve or build storybook. It will not work. 
NOTE: Downgrading to react-syntax-highlighter@^15 works.
System
Storybook Environment Info:
  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 20.19.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm <----- active
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @storybook/addon-docs: 9.1.13 => 9.1.13 
    @storybook/addon-onboarding: 9.1.13 => 9.1.13 
    @storybook/react-vite: 9.1.13 => 9.1.13 
    storybook: 9.1.13 => 9.1.13Additional context
No response
dosubot and alecluna