Giter Site home page Giter Site logo

Comments (6)

fi3ework avatar fi3ework commented on August 17, 2024

storybook-rsbuild's configuration is a little complex so for now you had to write the rsbuildFinal in the following style

import { mergeRsbuildConfig } from '@rsbuild/core'
import type { StorybookConfig } from 'storybook-react-rsbuild'
import { join, dirname } from 'path'

/**
 * This function is used to resolve the absolute path of a package.
 * It is needed in projects that use Yarn PnP or are set up within a monorepo.
 */
function getAbsolutePath(value: string): any {
  return dirname(require.resolve(join(value, 'package.json')))
}

const config: StorybookConfig = {
  stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
  addons: [
    getAbsolutePath('@storybook/addon-onboarding'),
    getAbsolutePath('@storybook/addon-links'),
    getAbsolutePath('@storybook/addon-essentials'),
    getAbsolutePath('@chromatic-com/storybook'),
    getAbsolutePath('@storybook/addon-interactions'),
  ],
  framework: {
    name: getAbsolutePath('storybook-react-rsbuild'),
    options: {},
  },
  docs: {
    autodocs: 'tag',
  },
  typescript: {
    reactDocgen: 'react-docgen',
    check: true,
  },
  rsbuildFinal: (config) => {
    return mergeRsbuildConfig(config, {
      tools: {
+       rspack(config, { addRules, mergeConfig }) {
+         return mergeConfig(config, {
+             module: {
+              rules: [
+               {
+                test: /\.md$/,
+                type: 'asset/source',
+             },
+              ],
+           },
          })
        },
      },
    })
  },
}

export default config

from storybook-rsbuild.

fi3ework avatar fi3ework commented on August 17, 2024

With above configuration, the .md could be rendered as plain text instead of Markdown style. Is that identical with webpack?
image

image image

from storybook-rsbuild.

nate-summercook avatar nate-summercook commented on August 17, 2024

Well, I'm importing it plain text to render it within an .mdx file. So that should work. Can't test it though until #30 is addressed ;) Unless I'd set up a separate project just to test this.

from storybook-rsbuild.

fi3ework avatar fi3ework commented on August 17, 2024

So when importing and using a .md in .mdx, the .md file could be render as Markdown content with webpack & SB8?

from storybook-rsbuild.

nate-summercook avatar nate-summercook commented on August 17, 2024

webpack & SB7, yes. But the import was *.md?raw but I think that results in pretty much the same.

from storybook-rsbuild.

fi3ework avatar fi3ework commented on August 17, 2024

I'll test does it works on webpack and SB8 then align with it.

from storybook-rsbuild.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.