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

[Bug]: Bun: Reading from "bun:test" is not handled by plugins (Unhandled scheme). #2502

Closed
ErreMalote opened this issue Jun 3, 2024 · 5 comments
Labels
bug Something isn't working need reproduction

Comments

@ErreMalote
Copy link

Version

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Pro
    Memory: 162.45 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Brave Browser: 125.1.66.118
    Chrome: 124.0.6367.119
    Safari: 17.5
  npmPackages:
    storybook-react-rsbuild
    @rsbuild/plugin-node-polyfill: ^0.7.2 => 0.7.2 
    @rsbuild/plugin-react: ^0.7.2 => 0.7.2

Details

bug with rsbuild
also the stream/web should resolve to "node:stream/web"
I added this to the main.ts

import { pluginNodePolyfill } from '@rsbuild/plugin-node-polyfill';
import { pluginReact } from '@rsbuild/plugin-react';
import { StorybookConfig } from 'storybook-react-rsbuild';

const config: StorybookConfig = {
  stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],

  addons: [
    '@storybook/addon-links',
    '@storybook/addon-essentials',
    '@storybook/addon-interactions',
    '@storybook/preset-create-react-app',
    '@storybook/addon-styling',
    '@chromatic-com/storybook'
  ],

  framework: 'storybook-react-rsbuild',
  rsbuildFinal: (config) => {
    config.resolve = {
      ...config.resolve,
      alias: {
        'stream/web': 'node:stream/web'
      }
    };
    // modify the final webpack config
    if (config.plugins) {
      config.plugins.push(pluginNodePolyfill(), pluginReact());
    } else {
      config.plugins = [pluginNodePolyfill(), pluginReact()];
    }
    return config;
  },
  staticDirs: ['../react-public'],

  docs: {}
};

export default config;

Reproduce link

hopefully not needed

Reproduce Steps

  • create a storybook
  • add bun tests to it
  • add the storybook bundler
  • run storybook
@ErreMalote ErreMalote added the bug Something isn't working label Jun 3, 2024
@chenjiahan
Copy link
Member

I'm not sure if Bun supports Storybook v8 now, there is an issue: oven-sh/bun#3794

@ErreMalote
Copy link
Author

ErreMalote commented Jun 5, 2024

yea, I am not using Bun to build. I am using storybook-react-rsbuild. bun:test is only used to test the jsx components. Webpack worked so I kept using webpack which would be this one @storybook/react-webpack5

I was thinking you could set a flag to ignore "bun:test" from the modules. since it is part of the runtime. or how do you do it when people call "node:stream" ?

@chenjiahan
Copy link
Member

I don't know much about bun:test, can you provide an reproduction?

Copy link
Contributor

github-actions bot commented Jun 6, 2024

Hello @ErreMalote. Please provide a reproduction repository or online demo. For background, see Why reproductions are required. Thanks ❤️

Copy link
Contributor

As the issue was labelled with need reproduction, but no response in 5 days. This issue will be closed. Feel free to comment and reopen it if you have any further questions. For background, see Why reproductions are required.

由于该 issue 被标记为 "需要重现",但在 5 天内没有回应,因此该 issue 将被关闭。如果你有任何进一步的问题,请随时发表评论并重新打开该 issue。背景请参考 为什么需要最小重现

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need reproduction
Projects
None yet
Development

No branches or pull requests

2 participants